05-02-2004
I thought I had it pretty much all set minus some minor modifications, but I guess I was wrong. All I'm trying to do is write a simple script that will append the text from one file to the beginning of all files I list as parameters.
What I am attempting is to be able to type the command:
$ myScript file1 file2...file10
and have the contents of file1 appended to each of the files listed after. Obviously, if there are less than two parameters an error must be generated, which I have accomplished successfully. I just don't know how to get the script to ignore the first parameter as part of the loop. I think that is my only real problem other than the error I'm getting in regards to the else statement part of my script.
Am I at least in the right ballpark with this one, or just plain lost in sauce?
#!/bin/bash
if [ $# -lt 2 ]
then
echo "Error: insufficient number of parameters."
exit 1
fi
until [ $# -eq 0 ]
do
if [ ! -rw $1 ] then;
echo "Error: permission denied."
else
cat $1 $* > /tmp/tfile
mv /tmp/tfile $*
shift
fi
done
exit 0
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
The script I am writing must be able to run several commands (tar, gzip etc) on filenames that are supplied by variables. I am unsure as to what syntax is required/ideal when referencing variables in filenames. The following is a sample command that I would like the script to execute:
tar cvf... (3 Replies)
Discussion started by: mharley
3 Replies
2. Programming
Undefined first referenced
symbol in file
std::basic_ostream<char, std::char_traits<char> >::operator<<(int)/var/tmp//ccTR
std::cerr /var/tmp//ccTRcjui.o
std::cout /var/tmp//ccTRcjui.o... (1 Reply)
Discussion started by: suhasini
1 Replies
3. Programming
Hey everyone, I can't figure out this symbol referencing error after looking at it for the longest time, and I figured some fresh eyes might be able to point something out I am overlooking.
Undefined first referenced
symbol in... (1 Reply)
Discussion started by: fromatz
1 Replies
4. Shell Programming and Scripting
Hi,
I have tried all examples of back referencing from the web but all in vain.
It would be heavily helpful if someone explains me the use of back referencing and sub expression using an example of substitution.
Thanks (1 Reply)
Discussion started by: sinpeak
1 Replies
5. AIX
Hello,
On Aix 5.2, we changed the parameters tcp_keepinit, tcp_keepintvl and tcp_keepidle with the no command.
tunrestore -R is present in inittab
in the directory /etc/tunables we can clearly see the inclusion of parameters during reboot, including the file lastboot.log
... (0 Replies)
Discussion started by: dantares
0 Replies
6. Shell Programming and Scripting
Is it possible to design a shell script to reference something that queries for input?
(This is not to make a script to ssh)
For instance if I have a command that when run, it does something like:
%<Some command>
User's password? Would it be possible to write a script to input something... (1 Reply)
Discussion started by: Prodiga1
1 Replies
7. Shell Programming and Scripting
I am referencing variables in the following way
var1="greeting"
greeting="Welcome!"
How do I echo var1 in such a way that it outputs Welcome! ? (3 Replies)
Discussion started by: milo7
3 Replies
8. Programming
Undefined first referenced
symbol in file
logf /var/tmp//ccwztFsO.o
ld: fatal: Symbol referencing errors. No output written to a.out
collect2: ld returned 1 exit status
float exponC(float mean)
{
index1++;... (1 Reply)
Discussion started by: willji1234
1 Replies
9. Shell Programming and Scripting
Hi
I have a file which has values in each line:
MP304,d40000
MP310,ff0000
etc
I have another file which as the first value in it and is unique in the file(not repeated). I need to replace a string with the second value above. The second file contents is as follows:(snippet)
<g
... (12 Replies)
Discussion started by: majikins
12 Replies
10. Shell Programming and Scripting
How would I reference a source path (where I have a script pulling data from) that changes location? For example, a Mail folder is being used as a source to pull some data, but somebody could move the folder around in the GUI of Mail, changing it's location in the filesystem (that I am referencing... (11 Replies)
Discussion started by: sudo
11 Replies
uudemon(4) Kernel Interfaces Manual uudemon(4)
NAME
uudemon.admin, uudemon.cleanu, uudemon.hour, uudemon.poll - Administrative shell scripts for polling remote systems, cleaning up spool
directories, reporting status to the system administrator, and routine invocations of the uuxqt and uusched daemons
SYNOPSIS
These shell scripts reside in the following directory:
/usr/lib/uucp
DESCRIPTION
All the scripts can be run from the command line or can be run automatically by the cron daemon. To automatically run the scripts, remove
the comment character (#) from the beginning of the relevant line in the /var/spool/cron/crontabs/uucp file.
This script reports status to the system administrator. It issues the uustat command to find out the status of uucp jobs. It mails the
results to the uucp login ID. The script may be modified to send mail to any login ID such as the uucp administrative login ID (uucpa) or
root. This script cleans up the /var/spool/uucp and /var/spool/uucppublic directories by running the uucleanup command. The uucleanup com-
mand is run with the following parameters: -C7, -D7, X2, -o2, -W1. This script runs the uusched and uuxqt daemons in the background. This
script polls the systems listed in the /usr/lib/uucp/Poll file. The uudemon.poll script should be scheduled before the uudemon.hour
script. This allows uudemon.poll to create any command files before cron runs the uudemon.hour script.
FILES
Contains the uudemon.admin, uudemon.cleanu, uudemon.hour and uudemon.poll files. Contains the uucp file.
RELATED INFORMATION
Commands: cron(8), uucleanup(8), uusched(8), uuxqt(1)
Files: /usr/lib/uucp delim off
uudemon(4)