Sponsored Content
Full Discussion: Begining Shell scripter
Top Forums Shell Programming and Scripting Begining Shell scripter Post 302140077 by synak on Wednesday 10th of October 2007 03:39:43 PM
Old 10-10-2007
#!/bin/bash
if [ $# -ne 1 ]
then
echo "usage: `basename $0` <-l|-w>"
exit 1
fi

case "$1" in
-l)
echo lines/filename
wc -l * | sort | grep -v ` basename $0` | grep -v ' total'
;;
-w)
echo words/filename
wc -w * | sort | grep -v ` basename $0` | grep -v ' total'
;;
*)
echo "usage: $0 <-l|-w>"
exit 1
;;
esac
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Use of #! at the begining ?

All, i have some doubt on #!/bin/bash or #!/bin/ksh at the begining of script. Need to know folowing thing ? -- what would be the problem if i will mention in the first line #!/bin/bash and will use korn shell syntax and the reverse ? -- Can i mention at the... (1 Reply)
Discussion started by: jambesh
1 Replies

2. Shell Programming and Scripting

new scripter

Hello all, new to scripting (and unix!) here. Im trying to write a script for something i have to do for work and for some reason it just isnt working. im using the ksh. Can someone please tell me why $PRODUCT=$1 CONFIG=./etc/$PRODUCT_config.xml print Using $CONFIG prints... (1 Reply)
Discussion started by: Gwoodhouse0
1 Replies
RBASH(1)						      General Commands Manual							  RBASH(1)

NAME
rbash - restricted bash, see bash(1) RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to bash with the exception that the follow- ing are disallowed or not performed: o changing directories with cd o setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV o specifying command names containing / o specifying a filename containing a / as an argument to the . builtin command o specifying a filename containing a slash as an argument to the -p option to the hash builtin command o importing function definitions from the shell environment at startup o parsing the value of SHELLOPTS from the shell environment at startup o redirecting output using the >, >|, <>, >&, &>, and >> redirection operators o using the exec builtin command to replace the shell with another command o adding or deleting builtin commands with the -f and -d options to the enable builtin command o using the enable builtin command to enable disabled shell builtins o specifying the -p option to the command builtin command o turning off restricted mode with set +r or set +o restricted. These restrictions are enforced after any startup files are read. When a command that is found to be a shell script is executed, rbash turns off any restrictions in the shell spawned to execute the script. SEE ALSO
bash(1) GNU Bash-4.0 2004 Apr 20 RBASH(1)
All times are GMT -4. The time now is 09:32 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy