11-06-2007
How to get files names passed to a script
I need to get files names passed to a script. Here number of files passed may vary
like MyScript.ksh file1 file2 file3..... so on
I am writting script somthing like this
set -A Files
while (i<=$#)
do
File[i]=$i
let i=i+1
done
Is this correct way doing this. Is there any other way.
Please let me know
Thanks.
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I registered a printer hp123 on Sun Solaris Server.
I think my printer is expecting a carriage return and linefeed combination at the end of each line (DOS standard), but unix files only have linefeeds at the end of each line.
How can I configure the lp system to filter files passed to it?... (1 Reply)
Discussion started by: simt
1 Replies
2. Shell Programming and Scripting
Hi there,
I am trying to do somehting similar, but on a wider scale.
I am trying to write a script that would open the home directory, open the first (of 650) user's folder
open the ?mail directory, which every user has
Then I need the script to read each of the files and folder names with... (2 Replies)
Discussion started by: technett
2 Replies
3. Shell Programming and Scripting
I'm an experienced awk user, but this one has me stumped. I have an awk script which is called from a UNIX command line as you'd expect:
myscript.awk -v foo=$1 -v bar=$2 filename
My question is this: is there a mechanism for determining the names of the -v variables within a script?
... (3 Replies)
Discussion started by: John Mac
3 Replies
4. Shell Programming and Scripting
Hi all
I want to use the filename passed into a shell script within the shell it self. The file will be passed as shown below
./myScript < myFile.file
i tried $1 but i think since myFile is not passed as a command line arg its not saving the file name in $1
any help is appreciated. (5 Replies)
Discussion started by: sridanu
5 Replies
5. Shell Programming and Scripting
i want to write a shell script function that will ftp the files passed in the command line . i have written a shell script for ftp but how will it do for all files passed in command line argument ,
i am passing 4 files as argument
./ftp.sh file1 file2 file3 file4
code written by me... (5 Replies)
Discussion started by: rateeshkumar
5 Replies
6. Shell Programming and Scripting
I have in directory /media/AUDIO/WAVE many .mp3 files with names like:
my filename_01of02.mp3
my filename_02of02.mp3
Your File_01of06.mp3
Your File_02of06.mp3
etc....
In the same directory, /media/AUDIO/WAVE, I have many folders with names like
9780743579490
9780743579491
etc..
Inside... (7 Replies)
Discussion started by: glev2005
7 Replies
7. Shell Programming and Scripting
I want to make a script which takes the number of argument, add those argument and gives output to the user, but I am not getting through...
Script that i am using is below :
#!/bin/bash
sum=0
for i in $@
do
sum=$sum+$1
echo $sum
shift
done
I am executing the script as... (3 Replies)
Discussion started by: mukulverma2408
3 Replies
8. Shell Programming and Scripting
Data files coming in different names in a file name called process.txt.
1. shipments_yyyymmdd.gz
2 Order_yyyymmdd.gz
3. Invoice_yyyymmdd.gz
4. globalorder_yyyymmdd.gz
The process needs to discard all the below files and only process two of the 4 file names available
... (1 Reply)
Discussion started by: dsravanam
1 Replies
9. Shell Programming and Scripting
Hi All,
I have a script which intends to create as many variables at runtime, as the number of parameters passed to it. The script needs to save these parameter values in the variables created and print them
abc.sh
----------
export Numbr_Parms=$#
export a=1
while
do
export... (3 Replies)
Discussion started by: dev.devil.1983
3 Replies
10. Shell Programming and Scripting
I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (8 Replies)
Discussion started by: Gurdza32
8 Replies