This rclone script is getting an error.
Destination path is in single quotes because it contains a space.
This is the rclone_space_in_path.sh script:
#!/usr/bin/env sh
cmd="rclone sync '/Volumes/Oliver/User Library' /run/media/wolfv/big_stick/test_rclone_backup --dry-run" #usage msg, but works from terminal
echo "cmd=$cmd"
$cmd
exit_code=$?
echo exit_code=$exit_code
It gets a “Command sync needs 2 arguments maximum” error when run from the Linux termanal:
$ ./rclone_space_in_path.sh
cmd=rclone sync '/Volumes/Oliver/User Library' /run/media/wolfv/big_stick/test_rclone_backup --dry-run
Usage:
rclone sync source:path dest:path [flags]
Flags:
-h, --help help for sync
Global Flags:
--acd-templink-threshold int Files >= this size will be downloaded via their tempLink. (default 9G)
...
-v, --verbose count[=-1] Print lots more stuff (repeat for more)
Command sync needs 2 arguments maximum
exit_code=1
When I copy the same rlcone command directly into the terminal, it works:
$ rclone sync '/Volumes/Oliver/User Library' /run/media/wolfv/big_stick/test_rclone_backup --dry-run
2018/08/03 22:19:51 ERROR : : error reading source directory: directory not found
2018/08/03 22:19:51 ERROR : Local file system at /run/media/wolfv/big_stick/test_rclone_backup: not deleting files as there were IO errors
...
Why does the same rclone command not work from the script?
I am using rclone v1.42 on Linux.
From https://rclone.org/docs/
If your names have spaces … then you must quote them. Use single quotes ’ by default.