•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 392,094 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,888 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
Views: 1678 | Replies: 4
![]() |
•
•
Join Date: Apr 2006
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
Hi all, i am new to shell scripting and know very few basics, i have a shell script program written by some other guy and i am trying to understand it. I am unable to understand a few parts of the program, hope some one cud help me with this ....
In the while loop what does $? mean and will it not go to an infinite loop, in the echo statement, what does get do, i guess "read var" reads a value from keyboard right, and finally what does done < testfile2.txt mean .....
Hope some one helps and thanks for your help ...
while [ "$?" = "0" ]
do
if [ "$var" ]
then
echo "get /somepath/$value/$var /somepath/$var" >> testfile1.txt
fi
read var
done < testfile2.txt In the while loop what does $? mean and will it not go to an infinite loop, in the echo statement, what does get do, i guess "read var" reads a value from keyboard right, and finally what does done < testfile2.txt mean .....
Hope some one helps and thanks for your help ...
•
•
Join Date: Apr 2006
Location: India
Posts: 16
Reputation:
Rep Power: 3
Solved Threads: 0
$? is variable in which the exit status of the last command is stored.
0 - Sucessful execution of command
1 - Error
The importance of this variable in shell scripting is that
"In a shell script, the error message is ignored and the script continues to execute. For this reason, it is necessary to check whether a program exited successfully."
Hope this helps.
Amit
0 - Sucessful execution of command
1 - Error
The importance of this variable in shell scripting is that
"In a shell script, the error message is ignored and the script continues to execute. For this reason, it is necessary to check whether a program exited successfully."
Hope this helps.
Amit
The get command edit a SCCS file. You can read about this in this link:
http://www.unet.univie.ac.at/aix/aix..._sccsfiles.htm
the done mark, is the final to the while loop, and the < file, say that is reading the input lines from that file.
http://www.unet.univie.ac.at/aix/aix..._sccsfiles.htm
the done mark, is the final to the while loop, and the < file, say that is reading the input lines from that file.
--------------
Elidio I. Marquina Ordon~ez
Programing surfer
The game is never over
Elidio I. Marquina Ordon~ez
Programing surfer
The game is never over
•
•
Join Date: Apr 2006
Location: India
Posts: 16
Reputation:
Rep Power: 3
Solved Threads: 0
i hope u got the answer to your queuries. You can find these commands with their explanation in any of the unix manuals.
Try out the tutorial listed at the top of this forum "Bourne / Bash Unix/Linux shell scripting tutorial". You will get answer of all your problems because these are the very basics of shell scripting
Amit
Try out the tutorial listed at the top of this forum "Bourne / Bash Unix/Linux shell scripting tutorial". You will get answer of all your problems because these are the very basics of shell scripting
Amit
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
Similar Threads
- Help!! bash shell scripting.. (Shell Scripting)
- Sleep Command in UNIX Shell Scripting (Shell Scripting)
- how to Upload files using Linux bash Shell scripting and CGI (Shell Scripting)
- shell scripting help with backup script (Shell Scripting)
- "shell scripting tutorials?" (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: sendmail problem using cron
- Next Thread: searching for files


Linear Mode