home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 45.14 Finding the Last Command-Line Argument Chapter 45
Shell Programming for the Initiated
Next: 45.16 Standard Input to a for Loop
 

45.15 How to Unset all Command-Line Parameters

The shift ( 44.17 ) command "shifts away" one command-line parameter. You can shift three times if there are three command-line parameters. Many shells also can take an argument, like shift 3 , that tells how many times to shift; on those shells, you can shift  $# ( 44.15 ) to unset all parameters.

The portable way to unset all command-line parameters is probably to set ( 44.19 ) a single dummy parameter, then shift it away:

set x
shift

Setting the single parameter wipes out whatever other parameters were set before.

- JP


Previous: 45.14 Finding the Last Command-Line Argument UNIX Power Tools Next: 45.16 Standard Input to a for Loop
45.14 Finding the Last Command-Line Argument Book Index 45.16 Standard Input to a for Loop

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System










??????????????@Mail.ru