Loading
Home ›
Getting User Input in a Shell Script
Trending Topics
| You Need A Budget | Feb 10, 2012 |
| The Linux powered LAN Gaming House | Feb 08, 2012 |
| Creating a vDSO: the Colonel's Other Chicken | Feb 06, 2012 |
| Your CMS Is Not Your Web Site | Feb 01, 2012 |
| Casper, the Friendly (and Persistent) Ghost | Jan 31, 2012 |
| Razor-qt 0.4 - Qt based Desktop Environment | Jan 30, 2012 |
- Fun with ethtool
- Parallel Programming with NVIDIA CUDA
- Readers' Choice Awards 2011
- 100% disappointed with the decision to go all digital.
- Linux-Based X Terminals with XDMCP
- Validate an E-Mail Address with PHP, the Right Way
- You Need A Budget
- The Linux powered LAN Gaming House
- Why Python?
- Python for Android
- Employment Posters
3 hours 6 min ago - Sure the best distro is
4 hours 26 min ago - BeOS was the best
7 hours 10 min ago - I use Wireshark on a daily
11 hours 40 min ago - buena información
16 hours 47 min ago - One important "bucket" that I didn't note (désolé si qqun deja d
17 hours 47 min ago - Gnome3 is such a POS. No one
1 day 3 hours ago - Gnome 3 is the biggest POS
1 day 3 hours ago - I didn't knew this thing by
1 day 9 hours ago - Author's reply
1 day 12 hours ago





Comments
RE: echo $?
The $? variable is the exit status of the last command. $1 is the first command line argument passed to the script.
For example, make a script like the following (give it some name I used test.sh):
#!/bin/bash
echo $1
exit 23
Make it executable: chmod 755 test.sh
Then run it with an argument, for example: ./test.sh "Hello"
Then after that run: echo $?
You'll see that "echo $1" in the script returned the argument you passed, while "echo $?" returned the number after "exit" in the script (the exit status).
I used an exit status other then 0 (true) or 1 (false) to hopefully make the example clearer.
Oops, meant to put it as a
Oops, meant to put it as a reply to Arup's question.
echo $?
Good tip Thanks,
but how does the ? in echo$? work
IS it like $1 ?
Zenity
I also use Zenity for most of my shell scripts, being on gnome I guess thats my alternative to kdialog.