Hi
I am trying to prompt the user to enter a filename after calling the script below and then copy this file to another server. My script works if the user enters the full path of the file (eg)user types:
test.sh /home/script/a.sh
In this situation, tesh.sh will be transferred to /home/script of server2
How can I transfer the file to the same location if the user only types the filename and not the path? In other words, user types:
test.sh a.sh
-------------------------
Contents of test.sh:
#!/bin/sh
USAGE="usage : $0 arg1"
if (($# > 1))
then
print "Error: This script can only copy one file at a time, please enter only one file name"
elif
(($# == 1))
then
rcp $1 server2:$1
-----------------
Thanks for any feedback
I am trying to prompt the user to enter a filename after calling the script below and then copy this file to another server. My script works if the user enters the full path of the file (eg)user types:
test.sh /home/script/a.sh
In this situation, tesh.sh will be transferred to /home/script of server2
How can I transfer the file to the same location if the user only types the filename and not the path? In other words, user types:
test.sh a.sh
-------------------------
Contents of test.sh:
#!/bin/sh
USAGE="usage : $0 arg1"
if (($# > 1))
then
print "Error: This script can only copy one file at a time, please enter only one file name"
elif
(($# == 1))
then
rcp $1 server2:$1
-----------------
Thanks for any feedback