I have written a shell script to enter into gentoo prefix and run commands. But once it enters in Gentoo prefix it stops and doesn't execute rest of the steps. According to me console has changed from RHEL to GENTOO which is preventing shell script from executing rest of commands. Is there any way that without entering in GENTOO prefix I can execute gentoo specific commands in shell script?
Commands used :
Gentoo_prefix
equery list > file.csv
Script :
cat file | awk '{print $3}'| cut -d '/' -f3 | cut -d '_' -f1 | sort -u | uniq -u | sed 's/.$//' > files
read -n 2 Detail
files=`echo $Detail | tr '[:upper:]' '[:lower:]'`
read server
Server=`echo $server | tr '[:upper:]' '[:lower:]'`
for nat in $(cat files)
do
for serv in $Server
do
if [ $files == $nat -a $Server == $serv ]
then
ls /tmp/$nat'0_'$serv/ | grep -i python > module
read module_name
ls /tmp/$nat'0_'$serv/$module_name/ | grep ^3 > version
$version_name = ' '
read version_name
for name in $(cat version)
do
if [ $version_name == ' ' ]
for pack in $(cat module)
do
if [ $version_name == $pack ]
then
$version_name
equery list > components.csv
In order to feed input to a command in a script, you have to pipe to it or use a here-doc, not just put the input after the command like you would if you were typing it interactively.
if [ $version_name == $pack ]
then
echo 'equery list > components.csv' | $version_name
or
if [ $version_name == $pack ]
then
$version_name <<EOF
equery list > components.csv
EOF