Visit Our UNIX and Linux User Community


Making flags for my script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Making flags for my script
# 1  
Old 06-28-2006
Making flags for my script

I have no idea how to make my own flags.
# 2  
Old 06-28-2006
I'm tempted to suggest needle and thread, but that wouldn't be helpful.

We need more information. Could you state what you mean? Could you explain what you're trying to do? Could you tell us what shell you're using?
# 3  
Old 06-28-2006
okay well im autmating the backup of log files and itll run fine most of the time in the middle of the night but i want to make flags if i need to manualy run the script if i want to run past a certain time and also if i want to only visit an individual server. im using bash.

Last edited by rcunn87; 06-28-2006 at 03:40 PM..
# 4  
Old 06-28-2006
Commandline paramaters show up as $0, $1, $2, etc. ./something.sh a b c would have "a" as $0, "b" as $1, "c" as $2. $# is the number of parameters.
# 5  
Old 06-28-2006
I think he wants to write something to a log, then use that information to restart the job at the point it died. Correct?
# 6  
Old 06-29-2006
Not exactly i want it to run with differnt vars and conditions depending on what flags i put out there. So i guess if i want to change vars according to a flag just do a case with the flags i want the $1... to match. but what happens if i change the order. because if i run the script "script -y -t" as i understand $1=y and $2=t so the case would only check for changing vars according to the order i put them in. How would i make it not order dependant.
# 7  
Old 06-29-2006
man getopts

Previous Thread | Next Thread
Test Your Knowledge in Computers #356
Difficulty: Medium
ibfawk is a very small, function-only, reentrant, embeddable interpreter written in PHP.
True or False?

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

Need script to remove GCOV flags from Qt project file

Hi, I have the following gcov compilation flags in all the QT source code project (*.pro) files. CONFIG(gcov) { LIBS += -lgcov QMAKE_CXXFLAGS += -fprofile-arcs -ftest-coverage } Now, I want to remove these flags off my files. Please help me with a script to... (1 Reply)
Discussion started by: royalibrahim
1 Replies

5. Shell Programming and Scripting

Help making a tasklog script

I am trying to create a program called tasklog that integrates with one of my online accounts, to keep track of what tasks I have been working on. On login, I'd like it to display (up to) the five most recent entries, then ask me what I plan to work on during the new session. I then will type an... (3 Replies)
Discussion started by: santod
3 Replies

6. Shell Programming and Scripting

flags passed to an awk script

I have an awk script script.awk for example and want to pass a flag (let's call it "neat") so that the data is put into nice columns. For example like this awk -v neat -f script.awk fin > fout Then check inside the program if the use has put neat, if yes I output the lines in nice columns,... (1 Reply)
Discussion started by: kristinu
1 Replies

7. UNIX for Dummies Questions & Answers

need help making a script executable

making a script in vi to create a shell script called wherearethey by entering the following script: echo -n "Who are you looking for: "read userif then list=`w | grep $user | cut -c19-30` if then echo "The user $user is logged in from $list" else echo "The user $user is not logged in... (3 Replies)
Discussion started by: curtner
3 Replies

8. Shell Programming and Scripting

making a archive script

Hi All: I'm not much of a script writer so I could use your input. Here's the objective... Need a script that will archive (tar) files based on date and then move them into an archive directory. The file names are as follows... S20070101.001 Year month day S20070102.001 As you can see... (1 Reply)
Discussion started by: jimmyc
1 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

Featured Tech Videos