doubt regarding making a script


 
Thread Tools Search this Thread
Operating Systems Solaris doubt regarding making a script
# 1  
Old 03-18-2009
doubt regarding making a script

Hi,
I want to execute around fifty commands on a server. I want to make it using a single command by placing the commands in a script. How to do this.
rogerben
# 2  
Old 03-18-2009
#!/usr/bin/sh

ls;
ls | wc -l;
du -sh;
df -h;


just open a file and write the cmds in the order u want to execute seperated by ';'
# 3  
Old 03-18-2009
Quote:
Originally Posted by daptal
#!/usr/bin/sh

ls;
ls | wc -l;
du -sh;
df -h;


just open a file and write the cmds in the order u want to execute seperated by ';'

after entering the commands in the file how to execute the file. can you please explain me in detail , since am in learning stage
rogerben
# 4  
Old 03-19-2009
assume the filename is list_of_commands


then just execute it using

sh list_of_commands (if you are using bash or sh)

Alternatively do
> which sh
this will give you the path

using the path execute the script in the above way

Hope this helps

cheers
# 5  
Old 03-19-2009
Quote:
Originally Posted by daptal
assume the filename is list_of_commands


then just execute it using

sh list_of_commands (if you are using bash or sh)

Alternatively do
> which sh
this will give you the path

using the path execute the script in the above way

Hope this helps

cheers

thanks a lot for ur help. it works
rogerben
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Help me making this script

This script is executed whenever a new vehicle is added to the cycle-motor park of campus. The script asks for the following information about the car and adds a new line to the vehicle file.txt: name (name of an animal, unique identifier), color, mark, model, type (e.g., electrical, manual),... (2 Replies)
Discussion started by: andre2222
2 Replies

2. Shell Programming and Scripting

Need Help With making this script

Hello, im a new user on this site and learning scripting very slowly at a understanding pace. However i am up with a challenge and require help completing this. The script has to include arguments, variables, decisions and loops. So the script is about calculating the broadcast address for any... (5 Replies)
Discussion started by: tHe666
5 Replies

3. Shell Programming and Scripting

I could use some help with making a script

I run a small instrument lab. We track our user's time on the instruments with a very manual process of 'last wtmp.1' then cut/paste data into spreadsheets. My boss makes the initial spreadsheets then I convert and format them for uploading into our billing software (COReS). Cores is looking for a... (8 Replies)
Discussion started by: jpontius
8 Replies

4. Shell Programming and Scripting

csh script doubt

Hi, I need to execute output one command in csh. Eg: #!/bin/csh set smal = "set count = 1" grep "Tot" in_file | sed "s/Tot/$smal/g" In the above script, i have set the smal variale as "set count = 1". My desired output like: $echo count should show as 1. (1 Reply)
Discussion started by: vasanth.vadalur
1 Replies

5. Shell Programming and Scripting

doubt in /etc/inittab script

Hi.. When i was just looking throught /etc/inittab file.. i had stuck with some problems that i dont known in shell scripts Here how the lablel like si ca lo l1 etc works.. do scripts proivide any label features.. please help... thanks in advance esham (3 Replies)
Discussion started by: esham
3 Replies

6. Shell Programming and Scripting

Perl script doubt?

Dear friends, I have two files. In first file first column ($1), i have numbers. The second file containes, the same number in the fourth column($4). I need a output file, matching the first file column 1 with second file column 4. The main thing is the output file lines will be sorted... (4 Replies)
Discussion started by: vasanth.vadalur
4 Replies

7. UNIX for Advanced & Expert Users

i have a doubt with the awk script??

Hi Guys, I am new to this forum, i have doubt with a awk script. I want to generate a list where i can busiest hour from a list of a data. 05/19/2008 14:27:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0 05/19/2008 14:28:19 - avg: 0 max: 0 min: 0 samples: 0 total: 0 05/19/2008 14:29:19 -... (2 Replies)
Discussion started by: asirohi
2 Replies

8. Shell Programming and Scripting

shell script doubt

Hi, While reading a shell script ,i have come accross the following statements. script_name_full=$0 ***script_name=${script_name_full##*\} ***script_name_noexst=${script_name%%\.ksh} host_name=`hostname` ***host_name_short=${host_name%%\.*} can anybody tell me what is the purpose of marked... (5 Replies)
Discussion started by: ravi raj kumar
5 Replies

9. Shell Programming and Scripting

making script

hello experts cany any one help me i want to make one script which can rlogin to another machine . but it should not ask me username/password from me of another machine it should take the username and password from the script only. please help me out. regards, shary (2 Replies)
Discussion started by: shary
2 Replies

10. Shell Programming and Scripting

Need help making a script

Here is what I have: #!/bin/bash # Setup year date and month YR=`date +%Y '{print $6}'` MON=`date +%b '{print $2}'` DAY=`date +%d '{print $3}'` file=$YR$MOY$DOM # clear # Dump database using USER/PASS to ..sql mysqldump --user=me -ppass database > database-db.$file.sql The YR, MON and... (2 Replies)
Discussion started by: npereira
2 Replies
Login or Register to Ask a Question