04-13-2006
New Person Added to the Forum
Hello,
I'm brand new to this forum. I am working on my first Bash shell script. We were given an exercise to get ready for the real assignment. I could use some help.
The exercise is to "set two variables (i. e., file1 & file2) on the command line to the paths of the text files. We are to create a shell script that does the following:
"if either variable does not have a value, output a message and stop. file1=${file1:?must set file1} & file2=:?must set file2} is what I've composed so far.
The output : "There are ___________ lines total in the files. ________has __________% (files) as many __________. "
#I did this part. I typed in lines of text into both files. We are to use quota, echo, run tests, and edit/compose the script in the Vi editor.
The process of doing this is a bit confusing to me.
First I set variables.
Second, I create paths w/text.
Third, I export files.
Fourth, run tests.
Fifth name script files in Vi.
What does $SHELL do?
Can someone model this entire process for me so that I can get a handle how to accomplish the basics of using vi and writing a script?
I would be greatful!
Sincerely,
William Carpenter
5 More Discussions You Might Find Interesting
1. Solaris
Ok i have a router, which my sparc 5 is connected to. I can acess the router webpage (192.168.0.1). But I cant access the internet.
When i use sys-unconfig i enter my ip address fine then i click none for when it asks me for DNS info because I dont have a domain. I was told i can manually change... (10 Replies)
Discussion started by: vikster007
10 Replies
2. Shell Programming and Scripting
I have given file with three columns,example:
mm234 5 22
mn237 6 45
de987 4 41
I have to check for input values in second and third column and if it is not numeric I have to deleted using grep function. I keep trying. But help from pros might help me.
We know that there is only one... (4 Replies)
Discussion started by: ljubayuu
4 Replies
3. What is on Your Mind?
Simple rules...
1. Guess who it is, the first person to get it posts the next picture, post your guess as a reply to this thread.
2. Wait for the person who posted the picture to confirm that you are correct before posting a new picture.
3. If the person who posted the picture does not answer... (268 Replies)
Discussion started by: reborg
268 Replies
4. Shell Programming and Scripting
Hi
My question:
Is there a way to lock a script if its already running for other users?
Like if i want to start a script, that is running by another user, there will be a message: Hey, you cant start the script because its running by another user, try it later.
my idea was that the... (10 Replies)
Discussion started by: DarkSwiss
10 Replies
5. What is on Your Mind?
Today I changed the forum mysql database to permit 2 letter searches:
ft_min_word_len=2
I rebuilt the mysql search indexes as well.
Then, I added a "quick search bar" at the top of each page.
I have tested this and two letter searches are working; but it's not perfect,... (1 Reply)
Discussion started by: Neo
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 file name 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)