This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
I'm new to shell scripting (very new): this is my first effort!
I'm trying to write a script that logs into server, gives it a password, then moves files via scp. I have this:
sshpass -p $PASSW scp [scp-opts] $FILE $LOGIN@servername:$DEST
where $FILE and $DEST are command line args, and $PASSW and $LOGIN are defined in .bashrc.
I know how to read arguments off the command line, but I want to be able to pass '-r' to scp, so I can transfer directories. I've been told that getopts handles options, but since I only want to use '-r', and nothing else, is there a good way to avoid using getopts?
Also, $PASSW is the password, in plain text. It's defined in my .bashrc. Is there a safer way to store it, and still use it as an argument to scp?
If there's a better place to post (a LearnShell reddit) let me know and I'll ask them.
Thanks!
Post Details
- Posted
- 9 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/shell/comme...