Help in passing argu


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help in passing argu
# 1  
Old 07-24-2006
Help in passing argu

These are the files avaible in directory
file_1.txt
file_2.txt
..
file_n.txt

how are the command to get the files starting with <file> and how to know the count of total files in the folder.

I am writing a commond and based on number of n Value i want to execte a command, therefore how to pass the argument for file counter.
# 2  
Old 07-24-2006
Code:
count=$(ls file_*.txt | wc -l)
./yourscript $count

count is passed as an argument to yourscript.

Last edited by vino; 07-24-2006 at 05:11 AM.. Reason: typo
# 3  
Old 07-24-2006
Code:
./yourscript $count

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Passing Variables

I have below data: DAY1=10202013 I am trying below but not getting the desired output: COUNT=1 DATE=DAY$COUNT echo "Date is $DATE" However output I am getting is: Date is DAY1 I wanted the output as: Date is 10202013 I tried following as well: DAY1=10202013 COUNT=1... (3 Replies)
Discussion started by: rockyr1985
3 Replies

2. Shell Programming and Scripting

Reading a string and passing passing arguments to a while loop

I have an for loop that reads the following file cat param.cfg val1:env1:opt1 val2:env2:opt2 val3:env3:opt3 val4:env4:opt4 . . The for loop extracts the each line of the file so that at any one point, the value of i is val1:env1:opt1 etc... I would like to extract each... (19 Replies)
Discussion started by: goddevil
19 Replies

3. UNIX for Dummies Questions & Answers

Passing arguments

I need to pass arguments to a shell script.My batch is calling some java program. ################# x=$1 y=$2 java -classpath program ################### if first parameter and second parameter is null then java -classpath program if first parameter is not null and second parameter is... (3 Replies)
Discussion started by: mnjx
3 Replies

4. Shell Programming and Scripting

passing arguments

Hi I have a script to which I pass multiple arguments, for example lets say the script name is "abc". I run the script like ./abc def /file <directory location> In the above "def" is the first argument and "/file" is the second argument. I expect <directory location> that is passed after... (4 Replies)
Discussion started by: zmfcat1
4 Replies

5. Shell Programming and Scripting

Passing Arguments-Help

Hi, I have a script which adds the user credentials to an ldap server. Im passing the variables as below.. /path/my_script $uname $pwd $environ ${deposit} If i enter some special characters like ';' in $pwd, script returns an error which is set to display if the user enters... (5 Replies)
Discussion started by: Tuxidow
5 Replies

6. Shell Programming and Scripting

passing value through ftp

how to pass value through FTP.Below the script in k-shell echo "Enter the month/day" read value ftp -v -n ddcappip031.tu.com << "EOF" user amit jason prompt cd /ednpdtu7/u01/pipe/Incoming/CurrentCollector/MeterReads/backupfiles mget CurrentCollectorMeterReadBackup2008'$value'.tar.gz... (13 Replies)
Discussion started by: ali560045
13 Replies

7. Shell Programming and Scripting

passing Argument

Hi All, i have script like below.. echo "1) first option" echo "" echo "2) second option" echo "" echo "*) please enter the correct option" read select case $select in 1) echo "first option selected" ;; 2) echo "second option selected" ;; *) echo "please enter the correct... (4 Replies)
Discussion started by: Shahul
4 Replies

8. UNIX for Advanced & Expert Users

Passing a password to su

Hi I am running unix commands through Oracle, but I want to be able to run sftp which oracle cannot use. What I want to do is run a script which runs as oracle user but has the su command in, to connect as another user that has sftp access. I am trying the below. su - dwintuser -c gary.ksh... (2 Replies)
Discussion started by: colesga
2 Replies

9. Shell Programming and Scripting

passing variables

Hi, Is there any way to pass variable to a sed script.For awk we have -v option.like that do we have any way to pass variable to a sed script from a awk script or from normal script? Thanx, sounder (1 Reply)
Discussion started by: sounder123
1 Replies

10. UNIX for Dummies Questions & Answers

passing a value

I am trying to write a program that calls two differant scripts. One sets a variable's value and the other one needs to be able to access that value. Can I pass the variable back to the program from the first script? (3 Replies)
Discussion started by: coughlin74
3 Replies
Login or Register to Ask a Question