Operating System - Linux
1826337 Members
2819 Online
109692 Solutions
New Discussion

can someone explain this...

 
Ratzie
Super Advisor

can someone explain this...

Can some one explain this...
IPLIST=/the/correct/path/sw_ip.txt
for IP in $(cat $IPLIST)
do
echo $IP
echo $IP
echo "$IP"
echo $IP ","
echo "$IP ,"
echo "$IP, changed passwd."
echo "$IP changed passwd."
echo $IP", changed passwd."
done

Output:
123.456.20.50
123.456.20.50
123.456.20.50
,3.456.20.50
,3.456.20.50
, changed passwd.
changed passwd.
, changed passwd.
5 REPLIES 5
Mark Travis
Frequent Advisor

Re: can someone explain this...

Well first figure out what shell you're using.

Bash maybe?

Then "man bash". Then look for something along the lines of what meaning quotes and $'s have.

They appear to have multiple meanings.

Or maybe make your shell "sh" and it won't have as many features to hang you up like this.
Ratzie
Super Advisor

Re: can someone explain this...

needed to dos2ux it!
Ragu_1
Regular Advisor

Re: can someone explain this...

Maybe the Sams book on Unix Shell Programming would help you. Do you want to change password upon change of IP ? Are you trying to do something ?
Share and share alike
Oren Amit
Advisor

Re: can someone explain this...

Just tried it on bash 2.05b.0(1)-release with no problem.
Please reply with your shell type & version.
Paul Cross_1
Respected Contributor

Re: can someone explain this...

i think he already figured it out...