Linux / UNIX Tech Support Forum
This is a discussion on How to pass a parameter to a shell script within the Shell scripting forums, part of the Development/Scripting category; I have 2 scripts, ftp_file.sh and sendfile.sh ftp_file.sh ~~~~~~ #!/bin/bash sftp -b /home/<instance>/script/ftp/sendfile.sh oracle@<host> sendfile.sh ~~~~~~~ #!/bin/bash cd /u01/<destination_directory> put ...
|
Register free or login to your existing account and remove all advertisements. |
|
|||||||
| Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I have 2 scripts, ftp_file.sh and sendfile.sh
ftp_file.sh ~~~~~~ #!/bin/bash sftp -b /home/<instance>/script/ftp/sendfile.sh oracle@<host> sendfile.sh ~~~~~~~ #!/bin/bash cd /u01/<destination_directory> put /d01/<source_directory>/xxx.out xxx.out When i run ./ftp_file.sh the sendfile.sh is executed and the xxx.out file is transferred from the source_directory to the destination_directory. This works fine. The sendfile.sh is hardcoded with xxx.out. How can i pass a parameter to sendfile in order to transfer other files to the destination_directory instead of just xxx.out? I am new to shell scripting. regards flyingrat |
| Sponsored Links | ||
|
|
|
||||
|
Code:
#!/bin/bash cd /u01/<destination_directory> put /d01/<source_directory>/$1.out $2.out $2 is second parameter sendfile.sh file1 file2 will transfer as Code:
put /d01/<source_directory>/file1.out file2.out
__________________
Vivek Gite Linux Evangelist |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Increasing the KERNEL parameter | sathiya | Ubuntu / Debian | 4 | 02-01-2008 11:36 AM |
| writing a shell script to find out my shell name | jaymob123 | Shell scripting | 1 | 10-08-2007 01:36 AM |
| SED pass a output line to another | cillo | Shell scripting | 6 | 11-01-2006 02:59 PM |
| user pass word | sparky | Shell scripting | 1 | 06-26-2006 08:19 PM |
| How to pass shell variable to awk program | Shell scripting | 4 | 06-23-2006 06:11 AM | |