Hi Guys, I want to create a shell script to run multiple jobs in sequence.
Explaination -
If I were to run each jobs individually I would have gone to folder - "abin"(where my shellscript is place) as follows
cd abin
abin > runappeng.sh abc001
Now, I have list of programs which are like abc001 thru abc010. So, my requirement is how to run the script to do this. Waht should I name it, so that when I go to abin folder and put scipt name as testmul.sh. It will intiate the sequence of programs getting executed and their status on the front end.
As to the status, the variable $? contains the return code of the previous command, so you could put after each line echo "abc001 finished with a return code of $?"
Sorry, abt asking such a simple question....but I seriously dont know how to do that. New kid on the block.
Step I did -
I prepared a file with
name as "test1.sh". Inside that file scripts were as follows - runappeng.sh abc001 runappeng.sh abc002 runappeng.sh abc003.
Now when I went to Home/abin > test1.sh
It thrown error -
ksh: Test1.sh: cannot execute
So, I am not sure where I am going wrong or what I am missing.
Chaits, as shell_life indicates, your file permissions does not let you to execute that file. if you do a ls -l yourfile you can see the permissions at the beginning of the line, something like -rwxrwxrwx. The gist of it is that there are 3 sets of permissions -- owner, group and other ('other' is anyone who isn't the owner or in the group). There are 3 options available -- (r)ead, (w)rite and e(x)ecute -- rwx. In order for you to run a file, it must be executable, e.g., the x flag must be set for whatever level of permission you have (if you're the owner, in the group or neither). 777 means rwxrwxrwx, which is the most permissive permission.
You use chmod to modify the access permissions on the file. We use numbers (aka, 777) to represent these flags. the 'r' is worth 4, the 'w' is worth 2 and the x is worth '1'. So, 4 + 2 + 1 = 7, and three sevens in a row means read, write, execute for owner, group and other. If you had permissions of 754, the owner would have read, write, execute, the group would have read and execute and other people would only have read.
You can look at this tutorial for more details on it.
I am trying to create a shell script similar to ls, but which only lists directories. I have the first half working (no argument version), but trying to make it accept an argument, I am failing. My logic is sound I think, but I'm missing something on the syntax, I'm guessing in the bolded line? ... (9 Replies)
I know php is a Web Development language but what does it have to do with shell scripting. I might be wrong about php. Is there a CLI? How do I make one and how does it work? Please don't answer these if you have any books on this. Please give names of good beginner books for php shell scripting... (3 Replies)
Hi,
I am newbie in shell scripting
I have a file name like simple.txt which comes from Mainframe systems onto windows dir every 15 minutes daily. File name is same. Every 15 minutes it updates.
I need to write shell script to check if the file arrived every 15 min or not.
If the new file... (4 Replies)
Could someone please recommend a very good shell scripting book for me. I would be starting a new job that would require a very good understanding of shell scripting. Please help. (3 Replies)
hi all,
i am just getting in to bash scripting, so don't be too harsh...
i've created this little backup script, and it's just awfull... ugly, doesn't work like I want it to, the works. anyways, i was hoping some of you might help me improve it and learn a little in the process.
what i... (13 Replies)
I have written a script that will email a generic user when a device is "offline". I would like to enhance this by having the script lookup a contact's email and automatically add it to the MAIL_LIST. I am trying to lookup and return data based on a field common in two files
File 1 ... (0 Replies)
Seems simple but I am having difficulty with this one: I am trying to write a single command line argument (which will be a path) - the program should print out the owner of the path.
I can not get anything I write to run.
Please help. (5 Replies)
I'm relatively new at this scripting game, just need to learn some basic stuff for data handling.
My current need is to write a script that loops through a textfile of filenames, and for each file removes the first line and re-writes that file to a new name.
In fact I could do with knowing... (1 Reply)
Hello Gurus,
Here's my problem, I have log files that are created automatically once a day by a feature of NetBackup called Vault. I usually move these files manually to a different location so I can FTP them later, however I know that this can be automated and so here's the info:
When vault... (2 Replies)
Hi all!
I'm a newbie to shell scripting.
I want to create a script that will store a line from a text file in a variable so I can then use it to open firefox with that text in the address bar (the text file contains a list of addresses).
I have tried the following:
#!/bin/sh
a='sed -n 2p... (2 Replies)