rsync unknown option from bash script execution
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm trying to simply sync a folder using rsync over my local network from my computer in front of me to the destination computer.
#!/bin/bash
echo "This script will sync from my Macbook Dropbox/scripts/ folder to ruth@10.0.0.9 @ Norms house"
OPTIONS="--recursive --ignore-existing --progress"
SRC_DIR="~/Dropbox/scripts/"
DST_DIR="ruth@10.0.0.9:~/scripts/"
rsync "$OPTIONS" "$SRC_DIR" "$DST_DIR"
To give myself write privileges
chmod +x nameofscript.sh
When I run it, it outputs:
rsync: --recursive --ignore-existing --progress: unknown option
How do I properly store these options and run it as a script?
bash shell-script ubuntu lubuntu
add a comment |Â
up vote
2
down vote
favorite
I'm trying to simply sync a folder using rsync over my local network from my computer in front of me to the destination computer.
#!/bin/bash
echo "This script will sync from my Macbook Dropbox/scripts/ folder to ruth@10.0.0.9 @ Norms house"
OPTIONS="--recursive --ignore-existing --progress"
SRC_DIR="~/Dropbox/scripts/"
DST_DIR="ruth@10.0.0.9:~/scripts/"
rsync "$OPTIONS" "$SRC_DIR" "$DST_DIR"
To give myself write privileges
chmod +x nameofscript.sh
When I run it, it outputs:
rsync: --recursive --ignore-existing --progress: unknown option
How do I properly store these options and run it as a script?
bash shell-script ubuntu lubuntu
1
Please donâÂÂt add your solution to your question; if you feel the accepted answer isnâÂÂt complete enough, you can suggest an edit to that, or add your own separate answer.
â Stephen Kitt
Mar 22 at 22:16
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm trying to simply sync a folder using rsync over my local network from my computer in front of me to the destination computer.
#!/bin/bash
echo "This script will sync from my Macbook Dropbox/scripts/ folder to ruth@10.0.0.9 @ Norms house"
OPTIONS="--recursive --ignore-existing --progress"
SRC_DIR="~/Dropbox/scripts/"
DST_DIR="ruth@10.0.0.9:~/scripts/"
rsync "$OPTIONS" "$SRC_DIR" "$DST_DIR"
To give myself write privileges
chmod +x nameofscript.sh
When I run it, it outputs:
rsync: --recursive --ignore-existing --progress: unknown option
How do I properly store these options and run it as a script?
bash shell-script ubuntu lubuntu
I'm trying to simply sync a folder using rsync over my local network from my computer in front of me to the destination computer.
#!/bin/bash
echo "This script will sync from my Macbook Dropbox/scripts/ folder to ruth@10.0.0.9 @ Norms house"
OPTIONS="--recursive --ignore-existing --progress"
SRC_DIR="~/Dropbox/scripts/"
DST_DIR="ruth@10.0.0.9:~/scripts/"
rsync "$OPTIONS" "$SRC_DIR" "$DST_DIR"
To give myself write privileges
chmod +x nameofscript.sh
When I run it, it outputs:
rsync: --recursive --ignore-existing --progress: unknown option
How do I properly store these options and run it as a script?
bash shell-script ubuntu lubuntu
edited Mar 22 at 22:14
Stephen Kitt
141k22307367
141k22307367
asked Mar 22 at 21:15
Kaiya
134
134
1
Please donâÂÂt add your solution to your question; if you feel the accepted answer isnâÂÂt complete enough, you can suggest an edit to that, or add your own separate answer.
â Stephen Kitt
Mar 22 at 22:16
add a comment |Â
1
Please donâÂÂt add your solution to your question; if you feel the accepted answer isnâÂÂt complete enough, you can suggest an edit to that, or add your own separate answer.
â Stephen Kitt
Mar 22 at 22:16
1
1
Please donâÂÂt add your solution to your question; if you feel the accepted answer isnâÂÂt complete enough, you can suggest an edit to that, or add your own separate answer.
â Stephen Kitt
Mar 22 at 22:16
Please donâÂÂt add your solution to your question; if you feel the accepted answer isnâÂÂt complete enough, you can suggest an edit to that, or add your own separate answer.
â Stephen Kitt
Mar 22 at 22:16
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
By quoting "$OPTIONS"
, the shell is passing it to rsync as a single string, so rsync is trying to find a single option named "--recursive --ignore-existing --progress"
, which obviously doesn't exist, since these are three separate options.
This should fix it for you:
rsync $OPTIONS "$SRC_DIR" "$DST_DIR"
A better option might be to use a bash array to store your options.
OPTIONS=(
--recursive
--ignore-existing
--progress
)
# ...
rsync "$OPTIONS[@]" "$SRC_DIR" "$DST_DIR"
The advantage of using an array is that then you are able to introduce items that include spaces, if any are necessary.
The bash array works great to store the options, I've edited my original with the correct script. Thank you.
â Kaiya
Mar 22 at 21:55
Awesome @Kaiya, I'm glad this worked for you!
â Filipe Brandenburger
Mar 22 at 22:06
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
By quoting "$OPTIONS"
, the shell is passing it to rsync as a single string, so rsync is trying to find a single option named "--recursive --ignore-existing --progress"
, which obviously doesn't exist, since these are three separate options.
This should fix it for you:
rsync $OPTIONS "$SRC_DIR" "$DST_DIR"
A better option might be to use a bash array to store your options.
OPTIONS=(
--recursive
--ignore-existing
--progress
)
# ...
rsync "$OPTIONS[@]" "$SRC_DIR" "$DST_DIR"
The advantage of using an array is that then you are able to introduce items that include spaces, if any are necessary.
The bash array works great to store the options, I've edited my original with the correct script. Thank you.
â Kaiya
Mar 22 at 21:55
Awesome @Kaiya, I'm glad this worked for you!
â Filipe Brandenburger
Mar 22 at 22:06
add a comment |Â
up vote
3
down vote
accepted
By quoting "$OPTIONS"
, the shell is passing it to rsync as a single string, so rsync is trying to find a single option named "--recursive --ignore-existing --progress"
, which obviously doesn't exist, since these are three separate options.
This should fix it for you:
rsync $OPTIONS "$SRC_DIR" "$DST_DIR"
A better option might be to use a bash array to store your options.
OPTIONS=(
--recursive
--ignore-existing
--progress
)
# ...
rsync "$OPTIONS[@]" "$SRC_DIR" "$DST_DIR"
The advantage of using an array is that then you are able to introduce items that include spaces, if any are necessary.
The bash array works great to store the options, I've edited my original with the correct script. Thank you.
â Kaiya
Mar 22 at 21:55
Awesome @Kaiya, I'm glad this worked for you!
â Filipe Brandenburger
Mar 22 at 22:06
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
By quoting "$OPTIONS"
, the shell is passing it to rsync as a single string, so rsync is trying to find a single option named "--recursive --ignore-existing --progress"
, which obviously doesn't exist, since these are three separate options.
This should fix it for you:
rsync $OPTIONS "$SRC_DIR" "$DST_DIR"
A better option might be to use a bash array to store your options.
OPTIONS=(
--recursive
--ignore-existing
--progress
)
# ...
rsync "$OPTIONS[@]" "$SRC_DIR" "$DST_DIR"
The advantage of using an array is that then you are able to introduce items that include spaces, if any are necessary.
By quoting "$OPTIONS"
, the shell is passing it to rsync as a single string, so rsync is trying to find a single option named "--recursive --ignore-existing --progress"
, which obviously doesn't exist, since these are three separate options.
This should fix it for you:
rsync $OPTIONS "$SRC_DIR" "$DST_DIR"
A better option might be to use a bash array to store your options.
OPTIONS=(
--recursive
--ignore-existing
--progress
)
# ...
rsync "$OPTIONS[@]" "$SRC_DIR" "$DST_DIR"
The advantage of using an array is that then you are able to introduce items that include spaces, if any are necessary.
answered Mar 22 at 21:18
Filipe Brandenburger
3,461621
3,461621
The bash array works great to store the options, I've edited my original with the correct script. Thank you.
â Kaiya
Mar 22 at 21:55
Awesome @Kaiya, I'm glad this worked for you!
â Filipe Brandenburger
Mar 22 at 22:06
add a comment |Â
The bash array works great to store the options, I've edited my original with the correct script. Thank you.
â Kaiya
Mar 22 at 21:55
Awesome @Kaiya, I'm glad this worked for you!
â Filipe Brandenburger
Mar 22 at 22:06
The bash array works great to store the options, I've edited my original with the correct script. Thank you.
â Kaiya
Mar 22 at 21:55
The bash array works great to store the options, I've edited my original with the correct script. Thank you.
â Kaiya
Mar 22 at 21:55
Awesome @Kaiya, I'm glad this worked for you!
â Filipe Brandenburger
Mar 22 at 22:06
Awesome @Kaiya, I'm glad this worked for you!
â Filipe Brandenburger
Mar 22 at 22:06
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f432936%2frsync-unknown-option-from-bash-script-execution%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
Please donâÂÂt add your solution to your question; if you feel the accepted answer isnâÂÂt complete enough, you can suggest an edit to that, or add your own separate answer.
â Stephen Kitt
Mar 22 at 22:16