Sponsored Content
Full Discussion: How to take arguments?
Top Forums UNIX for Dummies Questions & Answers How to take arguments? Post 302518605 by unclepickle1 on Saturday 30th of April 2011 02:02:54 PM
Old 04-30-2011
How to take arguments?

Hey everybody.

How do you write a program that will produce output based on its arguments?

For example, how would you write one that will add 1 to an integer argument so it would look like this:
Code:
$add 1 78
79
$

I only know how to write programs to take user input with the read function, which doesn't read arguments, only input on a separate line.

Thanks

Last edited by Yogesh Sawant; 05-01-2011 at 06:43 AM.. Reason: added code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[: too many arguments

Hi Guys I have this small Bash script - but it fails when I'm trying to run it. ./test.sh: && ; then # date >> /writable/sys/shutdown.log shutdown -h "now" exit fi done (4 Replies)
Discussion started by: tainted2real
4 Replies

2. Shell Programming and Scripting

Too many arguments?

I can't find anything wrong with this line of code, it works when there is one file in the directory but more than one i get a "too many arguements2 error if ; then am i missing something? (3 Replies)
Discussion started by: Alendrin
3 Replies

3. Shell Programming and Scripting

too many arguments?

i don't know what's wrong with the code, says too many arguments in the first two if statements. how to change it? thx. the file is like in this format: ;dfs;dfdsf;fsd ff dsf;dfdffdfd; -f2 should be only one word with no space, but could be like this 'n/a', '**ABC' while read line; do ... (1 Reply)
Discussion started by: dtdt
1 Replies

4. Shell Programming and Scripting

[: too many arguments

hi I am getting too many arguments error for the below line if ; then Thx in advance (1 Reply)
Discussion started by: vls1210
1 Replies

5. Shell Programming and Scripting

Too many arguments

echo "the number from 1 to 10:" i=1 while do echo $i i=`expr $i+1' done above is the program i written in Linux O.S using vi editor but i am getting the error that while: line 3: i am not understanding that why i am getting this error. can any body please help me regarding this... (3 Replies)
Discussion started by: bsatishbabu
3 Replies

6. 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

7. Shell Programming and Scripting

: [: too many arguments in for -f in if

Hi Experts , I have following code if ; then mv path /filename newdirpath echo "K* files moved successfully to newdirpath \n" else echo "K* files DID NOT moved successfully to newdirpath \n" fi I am getting "echo "K* files DID NOT moved successfully to newdirpath \n"... (19 Replies)
Discussion started by: ajaypatil_am
19 Replies

8. Shell Programming and Scripting

Using arguments

I have a SNMP agent that sends three arguments to the script to get a value at the end. The first is the LeafNumber, second is the request type (SET, GET, GETNEXT), and the last is a string that represents some value to be set(used only for set requests). The agent string looks like this: ... (3 Replies)
Discussion started by: jsoper1
3 Replies

9. Shell Programming and Scripting

Too many arguments

hi I have this code a="a b c" set -- $a if ; then echo empty fi why is it line 3 reports "test: [: too many arguments"? :wall: Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

10. Ubuntu

[: too many arguments

line 5: #!/bin/bash old=$(du -sh /home/andy/Downloads/myfile.iso) while true; do new=$(du -sh /home/andy/Downloads/myfile.iso) if ; then break fi old=$new xdotool getactivewindow key Ctrl sleep 5 done line 5: bash - Meaning of " (square brackets)... (9 Replies)
Discussion started by: drew77
9 Replies
RA_RGBE(1)						      General Commands Manual							RA_RGBE(1)

NAME
ra_rgbe - convert between different RADIANCE picture types SYNOPSIS
ra_rgbe [ -r ][ -e +/-stops ][ -f ][ -n frameno ] [ input [ outspec ] ] DESCRIPTION
Ra_rgbe converts between RADIANCE run-length encoded and flat formats, and separates concatanated animation frames produced by rpict(1). The -e option specifies an exposure compensation in f-stops (powers of two). Only integer stops are allowed, for efficiency. By default, ra_rgbe produces a flat RADIANCE picture file from any type of RADIANCE input picture. The -r option causes ra_rgbe to produce a run- length encoded file instead. If the input file consists of multiple animation frames as produced by rpict with the -S option, ra_rgbe will read each frame and write it to the output file created by calling printf(3) with the output specification and frame number as arguments. If the output specification begins with an exclamation mark ('!'), then this interpreted as a command spec., which is also run through printf with the frame number to get the final command. This command must accept a Radiance picture on its standard input, and may write results either to a file or to the standard output. The -n option may be used to select a specific frame for output, and other frames in the input will be skipped. Nor- mally, all frames will be read and written. Ra_rgbe will report an error and exit if the target output file already exists, unless the -f option is given. If the output file is miss- ing, the standard output is used. If the input file is missing or set to '-', the standard input is used. NOTES
The file format for RADIANCE pictures was changed between release 1.4 and release 2.0. The older format can still be read by all the pro- grams, but only the newer format is produced. This newer format cannot be read by RADIANCE software prior to release 2.0. Ra_rgbe provides some downward compatibility by producing files that can be read by older RADIANCE software. The resultant files are also easier to manipulate with programs designed to read raw raster data. The other use for ra_rgbe is as a quicker way to adjust the exposure of a RADIANCE picture than pfilt(1), since ra_rgbe only allows integer f-stop changes. In this mode, ra_rgbe should be used with the -r option. AUTHOR
Greg Ward ACKNOWLEDGEMENT
Work on this program was initiated and sponsored by the LESO group at EPFL in Switzerland. SEE ALSO
pfilt(1), printf(1), ra_xyze(1), rpict(1) RADIANCE
1/23/98 RA_RGBE(1)
All times are GMT -4. The time now is 12:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy