spacer
spacer search

i-Vibe.com
developer resource & tips portal

Search
spacer
Newsflash
01/27/06: I just had some time to cleanup this website. I will add more articles for AJAX this coming weekend.
 
splash.jpg
Main Menu
Home
Articles
Programming
Networking/Security
Data Modeling
Interface Design
Developer News
Downloads
Links
Login





Lost Password?
No account yet? Register
Related Articles
 
Home arrow Programming arrow Shell Scripts arrow Clear Arguments By Shifting
Clear Arguments By Shifting Print E-mail
  • Currently 1.0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Rating: 1.0/5 (2 votes cast)

Written by Roceller Alvarez   
Saturday, 26 February 2005
$ arguments in shell script are not cleared after execution. For example execute a script “exec.sh arg1″, arg1 is assigned to “$1″. When you execute “exec.sh” again without the argument, $1 value is retained. Using “shift” and by assigning argument to a variable will solve this problem:
# get arguments
EXTRA=""
until [ $# -eq 0 ]
do
EXTRA=$EXTRA" "$1
shift;
done

Comments

Only registered users can write comments.
Please login or register.

Powered by AkoComment 2.0!

 
< Prev   Next >
spacer
 
spacer