Sponsored Content
Top Forums Shell Programming and Scripting bash if loop for checking multiple parameters Post 302290438 by szittyafergeteg on Monday 23rd of February 2009 09:37:05 AM
Old 02-23-2009
Lightbulb bash if loop for checking multiple parameters

Hello,

I've got next problem:
I want to examine at the beginning of a script in an if loop that:
1. Is there 4 parameters given
2. If first state is true then: is there switches -e and -d?
3. At the end, how can i indentify them as variebles regardlees to its order.

I was thinking like this if [ "$#" == 4 && "$1" == -e && "$3" == -d ] ; then ...

Can anyone help me?
If loop could be here the right choice, at all?

Regards


 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parameters in loop

Hi, I am trying to write a script which will read inputs form user and process those files, I have issue reading the input parameters in a loop. Following is the script... I run the script as ./Script.sh 3 table1 table 2 table3 NumberOfTables=$1 let TableCount=1 while do ... (3 Replies)
Discussion started by: mgirinath
3 Replies

2. Shell Programming and Scripting

For Loop with Strings as parameters

I'm trying to create a script with a for loop that take strings in as the parameters. Some of the strings have spaces in them, and I can't get it to work properly. For example: #!/bin/ksh INFILE=snapshot.log OUTFILE=summary.out a="Lock waits" b="Deadlocks detected" for PARAM in... (6 Replies)
Discussion started by: kadishmj
6 Replies

3. Shell Programming and Scripting

for loop logic with multiple parameters

hi, unix wizards, i have a question about the logic of my inner for loop below. first, what i am trying to do is to write a script called create_account that automatically creates mysql accounts. the user can provide a user_name or a group_id as an argument (and the script can take multiple... (1 Reply)
Discussion started by: ankimo
1 Replies

4. Shell Programming and Scripting

checking the positional parameters

Hi all, I have one small requirment... I have prepared one script. we have to pass two possitional parameters to the script. What I want to do is if the parameters are not passed then i dont want the script to start the process... For ex: $ ./a.sh parm1 parm2 #Here, it can start... (7 Replies)
Discussion started by: raghu.iv85
7 Replies

5. Shell Programming and Scripting

Multiple condition checking in bash

Hi All, I am trying to check if two variables have value assigned to it. i am doing it like if ] then echo "Please specify either single hostname or host file for the report" usage exit fi But its not working for it.Even i specify values for both variables it dont go... (6 Replies)
Discussion started by: kailash19
6 Replies

6. UNIX for Dummies Questions & Answers

Problem with multiple grep in bash loop

Hello, I am trying to create a matrix of 0's and 1's depending on whether a gene and sample name are found in the same line in a file called results.txt. An example of the results.txt file is (tab-delimited): Sample1 Gene1 ## Gene2 ## Sample2 Gene2 ## Gene 4 ## Sample3 Gene3 ... (2 Replies)
Discussion started by: InfoSeeker2
2 Replies

7. Shell Programming and Scripting

Detail on For loop for multiple file input and bash variable usage

Dear mentors, I just need little explanation regarding for loop to give input to awk script for file in `ls *.txt |sort -t"_" -k2n,2`; do awk script $file done which sorts file in order, and will input one after another file in order to awk script suppose if I have to input 2 or... (4 Replies)
Discussion started by: Akshay Hegde
4 Replies

8. Shell Programming and Scripting

Record count checking for multiple files through for-loop

Hi Friends, I wrote one shell script to check the record count in two files and that will send us the notification activity if found zero record count. What i did is I created for loop and checking the count for both of the files but what is happening is for first file has data then it's... (13 Replies)
Discussion started by: victory
13 Replies

9. Shell Programming and Scripting

Loop through multiple files in bash script

Hi Everybody, I'm a newbie to shell scripting, and I'd appreciate some help. I have a bunch of .txt files that have some unwanted content. I want to remove lines 1-3 and 1028-1098. #!/bin/bash for '*.txt' in <path to folder> do sed '1,3 d' "$f"; sed '1028,1098 d' "$f"; done I... (2 Replies)
Discussion started by: BabyNuke
2 Replies

10. Shell Programming and Scripting

Checking File record equal to multiple of 70 or nearest number to multiple of 70

Hello, I have a file with below content - Example 3 6 69 139 210 345 395 418 490 492 I would like the result as - Multiple of 70 or nearest number in the file less than the multiple of 70 69 139 (5 Replies)
Discussion started by: Mannu2525
5 Replies
NWDIAG(1)						      General Commands Manual							 NWDIAG(1)

NAME
nwdiag - generate network-diagram image file from spec-text file. SYNOPSIS
nwdiag [options] files DESCRIPTION
This manual page documents briefly the nwdiag commands. nwdiag is generate sequence-diagram image file from spec-text file. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. -h, --help show this help message and exit. --version show program's version number and exit. -a, --antialias Pass diagram image to anti-alias filter. -c FILE, --config=FILE read configurations from FILE. -o FILE write diagram to FILE. -f FONT, --font=FONT use FONT to draw diagram. -T TYPE Output diagram as TYPE format. SEE ALSO
The programs are documented fully by http://blockdiag.com/en/nwdiag/ AUTHOR
nwdiag was written by Takeshi Komiya <i.tkomiya@gmail.com> This manual page was written by Kouhei Maeda <mkouhei@palmtb.net>, for the Debian project (and may be used by others). June 11, 2011 NWDIAG(1)
All times are GMT -4. The time now is 10:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy