1. The problem statement, all variables and given/known data:
Write a script that asks for 4 arguments, and the 1st and 3rd need to be -i and -o, and the 2nd/4th need to be file names.
Technically, it's supposed to be run as:
./Lab_14.sh -i input.txt -o output.txt
Depending on how many arguments are used, and what the arguments are, error messages will pop up (ie- too many/few arguments, not an existing filename, etc etc etc)
2. Relevant commands, code, scripts, algorithms:
Required Errorlevels
Errorlevel# Event Information
0 Script functions correctly
10 No arguments provided on command line (=0)
11 First argument missing (=0)
12 First argument present, but not what expected (“-i”)
13 Second argument missing on command line
14 Second argument present, but file does not exist
15 Third argument missing on command line
16 Third argument present, but not what expected (“-o”)
17 Fourth argument missing on command line
18 Too many arguments provided on command line (>4)
Variable Interpolation
The script must be as dynamic as possible. Variables are to be used for command line arguments, user input, and generated output throughout the script. Hard-coded values, where variables can be used, are unacceptable.
3. The attempts at a solution (include all code and scripts):
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
Mohawk College, Hamilton, ON, Canada, Cheryl Weaver, dunno my course number right now
---------- Post updated 03-29-10 at 10:52 AM ---------- Previous update was 03-28-10 at 05:34 PM ----------
ignore my nonsense, I fixed it after a marathon of vi editing
I have 68 servers whose /etc/ntp.conf file have the wrong NTP server name and they need to be updated with a different or correct NTP server name. I am doing this on AIX
Here is what I would like.
and I would need a script that would rename the old /etc/ntp.conf and add a date stamp to it ... (1 Reply)
Hiya,
I want to allow some users to copy all filenames of a specific filetype, to a limited directory.
3+ users: need to be able to copy(as root) any *.war file to /usr/local/tomcat/current/webapps/
I tried the following...
dmurphy huskar=/tmp/who.sh,/bin/cp *.war... (2 Replies)
Dear all,
Today I spend almost all my day with something I hope any of you can help me with...
I'm trying to write a small script (!/bin/sh) to be able to make 900 copies of one file. Can anyone help me with this? I couldn't figure this out (maybe I need to create some sort of loop) and couldn't... (8 Replies)
Has anyone come accross and solved an issue where only 1 copy of a doc prints after you use the -n flag and specify more then 1. My exact syntax is
lp -dprintername -n3 documentname
enq command does same thing.
Both commands show the 3 copies in the queue but only 1 ever prints
I am using AIX... (0 Replies)
Hi, this is my first post so I hope I have placed it in the appropriate section!
I have created a looping script to print a text file multiple times.
The script works great, and it displays the job numbers of all the prints that result from its execution.
The trouble is, only the first job... (1 Reply)
I work as a website designer where I work on different directories on a server but my boss doesnt give me root permission for security reasons. So I have a temporary folder where I work and he copies the files over as he has root permission. The command he uses is usually like:
cp -fR... (4 Replies)
I have to put a single/identical file to numerous different directories on a website and update them simultaneously and identically.
If I have the master file in directory a/, how can I make a "virtual copy" of this file into an other directory, in a way that any changes to the master file will... (2 Replies)
Hi,
We have an application running on AIX5.3 that generates text files that are sent to be printed using the lp command.
The user can specify the number of copies they want printed, but only one copy ever gets printed.
I've checked the lp command that is used, and it correctly specifies... (5 Replies)
I'm trying to print multiple copies of a file on sun solaris 8 with the lp -n command to no
avail. No matter what numeric value I supply -n, I still only get 1 copy
of the file printed.
The command I'm using is 'lp -d SNY_IT5000-2 -n2 file'
The printer is an HP Laserjet 4000 with a... (2 Replies)