Sponsored Content
Top Forums Shell Programming and Scripting Make a list in bash out of arguments Post 302330883 by jolecanard on Thursday 2nd of July 2009 04:03:44 PM
Old 07-02-2009
Make a list in bash out of arguments

Hello,

I have a very stupid/simple problem, but for some reason I cannot figure out...and I need your help!

I am writting a bash scrip that should be executed using "my_script X Y Z T" where X Y Z and T can be any string, but there can be any number of arguments.

I want my script to do a list from these inputs:
Code:
#!/bin/bash
 
i=1
while [ $i -le $# ]
do
list=$list" ./myfile."$i
i=`expr $i + 1`
done
echo $list

Using the above script, I got:
./myfile.1 ./myfile.2 ./myfile.3 ./myfile.4
instead of:
./myfile.X ./myfile.Y ./myfile.Z ./myfile.T


Thanks for your help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Make new arguments for echo command

Hi everybody, i want to make an argument at echo command that takes a alpharithmetic and returns it reversed. How this can be done? plus what makefile changes are needed (0 Replies)
Discussion started by: Panteras
0 Replies

2. Shell Programming and Scripting

How to read arguments to make command

In the make file update updateq: ------------------- ---------- i want the makefile to display some messages when user gives "make update", but totally quite wehn user enters "make updateq". Can u tell me how to read these argument in makefile. $1 doesnt work:( (3 Replies)
Discussion started by: vikashtulsiyan
3 Replies

3. Shell Programming and Scripting

how to make your bash script run on a machine with csh and bash

hi, i have a script that runs on bash and would like to run it on a machine that has csh and bash. the default setting on that machine is csh. i dont want to change my code to run it with a csh shell. is there any way i can run the script (written in bash) on this machine? in other words is there... (3 Replies)
Discussion started by: npatwardhan
3 Replies

4. Homework & Coursework Questions

I need to make a script that has 4 command line arguments to function properly.

I have no idea what the following means. The teacher is too advanced for me to understand fully. We literally went from running a few commands over the last few months to starting shell scripting. I am not a programmer, I am more hardware oriented. I wish I knew what this question was asking... (3 Replies)
Discussion started by: Wookard
3 Replies

5. Shell Programming and Scripting

How to make 2 separate arguments in 1 bash script?

This is what I have: #!/bin/bash #ascript.sh WORD1=`tail -n +$1 /home/gscn/word1.txt | head -1` sed -e "s/WORD1/$WORD1/g" < /home/gscn/configtmp > /home/gscn/config WORD2=`tail -n +$1 /home/gscn/word2.txt | head -1` sed -e "s/WORD2/$WORD2/g" < /home/gscn/config2tmp >... (4 Replies)
Discussion started by: guitarscn
4 Replies

6. Shell Programming and Scripting

How to make bash wrapper for java/groovy program with variable length arguments lists?

The following bash script does not work because the java/groovy code always thinks there are four arguments even if there are only 1 or 2. As you can see from my hideous backslashes, I am using cygwin bash on windows. export... (1 Reply)
Discussion started by: siegfried
1 Replies

7. Shell Programming and Scripting

How to make shell script arguments optional?

Here is my script: #!/bin/ksh usage () { echo " Usage: $0 <opt1> <opt2> <opt3> <opt4>" } if ; then usage exit; fi prog -a $1 -b $2 -c $3 -d $4 2>&1 | tee -a ~/$1.log I want argument 4 to be optional, so if there's no argument for opt4, that it doesn't... (8 Replies)
Discussion started by: guitarscn
8 Replies

8. UNIX for Dummies Questions & Answers

Command - filename as arguments - make executable to all users.

Edit: Sorry. Mistakenly posted - please delete (3 Replies)
Discussion started by: Reddax
3 Replies

9. Programming

Make a file accept only two arguments from the command line

DELETED (2 Replies)
Discussion started by: ProgMan2015
2 Replies

10. Homework & Coursework Questions

Make a file accept only two arguments from the command line

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1) The script is executed in the Korn shell. 2) Name the shell script file is asg6s. 3) The asg6s file is... (7 Replies)
Discussion started by: ProgMan2015
7 Replies
rsvg(1)                                                            User Commands                                                           rsvg(1)

NAME
rsvg - convert SVG files into raster images SYNOPSIS
rsvg [--dpi number] [--format png|jpeg] [--height integer] [--version] [--width integer] [--x-zoom number] [--y-zoom number] infile.svg outfile.png|outfile.jpeg DESCRIPTION
rsvg converts SVG images into PNG and JPEG raster images. OPTIONS
The following options are supported: --dpi number Set the resolution of the image in pixels per inch. The default value is 90dpi. You can also use -d to specify this option. --format png | jSpecify the output format for the converted image. The default value is png. You can also use -f to specify this option. --height integerSpecify the height of the converted image. The default value is the height of the original image. You can also use -h to specify this option. --version Display rsvg version information. You can also use -v to specify this option. --width integer Specify the width of the converted image. The default value is the width of the original image. You can also use -w to specify this option. --x-zoom number X Zoom factor, as a percentage. The default value is 1.0. You can also use -x to specify this option. --y-zoom number Y Zoom factor, as a percentage. The default value is 1.0. You can also use -y to specify this option. OPERANDS
The following operands are supported: infile.svg The name of the input SVG file. outfile.png The name of the converted PNG file. outfile.jpeg The name of the converted JPEG file. EXAMPLES
Example 1: Converting an SVG Image to PNG example% rsvg myfile.svg myfile.png Example 2: Converting an SVG Image to JPEG at 300dpi Resolution example% rsvg -f jpeg -d 300 myfile.svg myfile.jpg EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/rsvg Executable to convert SVG files into raster images ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-base-libs | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
http://librsvg.sourceforge.net/ http://www.w3.org/TR/SVG11/ NOTES
Original man page written by Dom Lachowicz (cinamod@hotmail.com), Alex Larsson (alex@redhat.com), and others. Updated by Laszlo Peter, Sun Microsystems Inc., 2004. SunOS 5.10 7 Sep 2004 rsvg(1)
All times are GMT -4. The time now is 12:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy