Linux or UNIX: Shell Special Vriable
Unknown
5:57 PM
Bash Shell
,
Linux
,
Linux tutorial
,
shell programing
,
Shell scripting tutorial
,
unix
,
vi editor
No comments
These are the special shell variables which can be used in shell scripts in Linux.
Here is an example of a shell script using one of the special shell variables.
I have used the code
$#
- Denotes the number of arguments you have passed to the shell script from the command line.$@
- All arguments, as separate words.$*
- All arguments, as one word.$$
- ID of the current process.$?
- Exit status of the last command.$0,$1,..$9,${10},${11}…${N}
- These are positional parameters. After “9″ you must use the ${k}
syntax.Here is an example of a shell script using one of the special shell variables.
#!/bin/sh #File: test.sh echo $$
I have used the code
echo $$
. If you run the script, it will print its process ID.
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment