Hi all,
In a while loop, like below...
while read line
do
read choice
case $choice in
1)
echo "xxx"
esac
done < file
why I can't run the read choice???? (3 Replies)
Hi Gurus
I have a file called /tmp/CMDB which looks like this
serial: 0623AN1208
hostname: server1
model: x4100
assetID: 1234
I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Hi,
im having problem creating a loop using my code: aside from the fact that the 1st variable (VAR) does not increment, it loops more than the expected output.
for sample purposes, test csv contains 3 lines.
#get number of lines in the file
lines=$( wc -l < test.csv )
... (5 Replies)
Hi,
The requirement is to ssh to unix servers and oracle databases, to perform some monitoring activity. I'm using shell script to perfom this.
I pass the server details and database to a variable ...
SERVERS="SERVER1 SERVER2 SERVER3"
DATABASE="DB1 DB2 DB3"
for i in $SERVERS
do
ssh... (2 Replies)
Hi,
I am using su within a for loop. As you might expect, it prompts for password during each loop execution. Here is my piece of code:
for i in $LIST
do
if
then
DATABASE=`echo $i | awk -F "|" '{ print $1 }'`
USER_ID=`echo $i | awk -F "|" '{ print $2 }'`
su - apstage -c... (1 Reply)
Hi all
Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Hi,
I am having a file like,
#cat file
Jun 19 13:08
Jun 19 13:08
Jun 19 13:08
Jun 19 13:14
when I run the below comamnd locally it will work fine,
IFS=$'\n'; for i in $(cat file) ;do echo "HI $i" ; done
And the output is,
HI Jun 19 13:08
HI Jun 19 13:08
HI Jun 19 13:08
HI... (1 Reply)
I'm taking a unix class and need to countdown to 0 from whatever number the user inputs. I know how to do this with a while or until loop but using the for loop is throwing me off....
I know I can use an if-then statement in my for loop but can I include a while loop in my for loop? (3 Replies)
I have a XML file of little huge size. I have to build a logic to get the count of the tag <capacity>.
And have an if loop such that all the <capacity> blocks are captured one after the other.
sample input file - sample1.xml
<subcolumns><capacity><name>45.90</name>
<index>0</index>... (1 Reply)