Finding arguments for variables

 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers Finding arguments for variables
# 1  
Old 07-23-2016
Finding arguments for variables

Hello, I've done considerable research but haven't been able to locate info on finding available arguments for variables, and really anything that doesn't come with an associated Man page.

For instance:

$RETURN_CODE -ne 0

Clearly "ne" stand for Not Equal, and likewise if I replaced it with "-eq" that would be Equal.

But I haven't found anywhere that lists out arguments for a given variable.

Can anyone help? Does such an argument repository even exist?

Thanks!
# 2  
Old 07-23-2016
man test or man [will cover cases where your script uses:
Code:
test $RETURN_CODE -ne 0

and:
Code:
[ $RETURN_CODE -ne 0 ]

For cases where your script uses:
Code:
[[ $RETURN_CODE -ne 0 ]]

you'll need to look at the man page for your shell (which will probably also cover test expression and [ expression ] in addition to [[ expression ]]).
# 3  
Old 07-23-2016
Don,

Thanks so much for the reply. Actually though, I found I didn't ask this question appropriately. The -ne and -eq in my example are comparison operators not arguments, and I found a list of operators online.

Thanks again!
# 4  
Old 07-23-2016
Shouldn't the man page of your shell be the first choice before searching the net? man bash:

Quote:
CONDITIONAL EXPRESSIONS
Conditional expressions are used by the [[ compound command and the test and [ builtin commands to test file attributes and perform string and arithmetic comparisons. .
.
.
arg1 OP arg2
OP is one of -eq, -ne, -lt, -le, -gt, or -ge.
# 5  
Old 07-23-2016
Hi.

I like Advanced Bash-Scripting Guide because it has tables and examples.

Best wishes ... cheers, drl
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Positional Parameters Arguments/Variables when using dot (.)

Hi, Is there a special positional variables for when using the dot (.)? Scripts are as below: $: head -100 x.ksh /tmp/y.ksh ==> x.ksh <== #!/bin/ksh # . /tmp/y.ksh 1234 abcd echo "yvar1 = $yvar1" echo "yvar2 = $yvar2" ==> /tmp/y.ksh <== #!/bin/ksh (2 Replies)
Discussion started by: newbie_01
2 Replies

2. UNIX for Dummies Questions & Answers

How to pass variables into anothother variables?

Below are three variables, which I want to pass into variable RESULT1 username1=userid poihostname1=dellsys.com port1=8080 How can I pass these variables into below code... RESULT1=$((ssh -n username1@poihostname1 time /usr/sfw/bin/wget --user=sam --password=123 -O /dev/null -q... (4 Replies)
Discussion started by: manohar2013
4 Replies

3. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies

4. Shell Programming and Scripting

Running a script with multiple variables like 25 variables.

Hi All, i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way?? #!/bin/ksh ##script is sample.ksh age=$1 gender=$2 class=$3 . . .... (3 Replies)
Discussion started by: Lakshman_Gupta
3 Replies

5. Shell Programming and Scripting

grep with two arguments to arguments to surch for

Hello, is it possible to give grep two documents to surche for? like grep "test" /home/one.txt AND /home/two.txt ? thanks (1 Reply)
Discussion started by: Cybertron
1 Replies

6. SCO

Help finding where certain environment variables are set

i have two machines that should be identical but on one system there are some oracle environment (ORACLE_SID, ORACLE_HOME, etc...) variables that are not being set for the users. I am trying to find where those environment variables are being set on the system which is working properly. All... (5 Replies)
Discussion started by: kuliksco
5 Replies

7. Homework & Coursework Questions

BASH Environment Variables as arguments?

1. The problem statement, all variables and given/known data: Write a shell program called myenv which takes one argument. The argument should be the name of an environment variable, such as PATH HOME etc. myenv should print out the value of the variable given as the argument. If no argument is... (1 Reply)
Discussion started by: Helix
1 Replies

8. Programming

How to convert byteArray variables to HexaString variables for Linux?

Hello everybody, I am having problem in converting byte array variables to Hexa String variables for Linux. I have done, converting byte array variables to Hexa String variables for Windows but same function doesn't work for linux. Is there any difference in OS ? The code for Windows is given... (2 Replies)
Discussion started by: ritesh_163
2 Replies

9. Shell Programming and Scripting

finding duplicate files by size and finding pattern matching and its count

Hi, I have a challenging task,in which i have to find the duplicate files by its name and size,then i need to take anyone of the file.Then i need to open the file and find for more than one pattern and count of that pattern. Note:These are the samples of two files,but i can have more... (2 Replies)
Discussion started by: jerome Sukumar
2 Replies

10. Answers to Frequently Asked Questions

Passing variables/arguments/parameters to commands

A good place to start is simple variable passing.... Passing variables from one script to another The next level is passing a variable into a more complex command such as using a variable in a sed command. There are some simple quoting techniques that are very general. These are mentioned... (0 Replies)
Discussion started by: Perderabo
0 Replies
Login or Register to Ask a Question