I'm trying to use Grsync on Linux Mint Debian Edition 7 to backup/sync between several drives. I've encountered a major roadblock in the form of environment variables; I want to be able to use the same sessions for multiple users and locations, but when I put those variables in Source and Destination paths (e.g., "/home/$USER/" or "home/%USER%/"), Grsync gives me errors like "change_dir "/home/$USER" failed: No such file or directory". (For the record, I'm using $USER for this example because it's simple and universal - I need to use other variables, some of which I'm creating, so any method that would only get me to the home directory wouldn't suffice.)
In Terminal, rsync can interpret variables fine. But it's beyond my skills and time to figure out how to use the command line to do everything else Grsync does that I need. I've tried.
FreeFileSync can handle variables, but its roadblock is difficulties with modification times on copied files. This is actually my second go at Grsync because it supposedly doesn't have that problem.
Am I missing something? Is there some way to use environment variables in Grsync, or am I out of luck?
Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The reason why running rsync from a shell works is because it's the shell
itself expanding the variables.
Normally, grsync runs rsync without passing through a shell, that's why
there's no expansion in that case.
I'm planning to add a session checkbox to "pass command through a shell"
for that reason; meanwhile, you can do the same by prepending the command
with "sh -c", or something like that.
I'm trying to use Grsync on Linux Mint Debian Edition 7 to backup/sync
between several drives. I've encountered a major roadblock in the form of
environment variables; I want to be able to use the same sessions for
multiple users and locations, but when I put those variables in Source and
Destination paths (e.g., "/home/$USER/" or "home/%USER%/"), Grsync gives me
errors like "change_dir "/home/$USER" failed: No such file or directory".
(For the record, I'm using $USER for this example because it's simple and
universal - I need to use other variables, some of which I'm creating, so
any method that would only get me to the home directory wouldn't suffice.)
In Terminal, rsync can interpret variables fine. But it's beyond my skills
and time to figure out how to use the command line to do everything else
Grsync does that I need. I've tried.
FreeFileSync can handle variables, but its roadblock is difficulties with
modification times on copied files. This is actually my second go at Grsync
because it supposedly doesn't have that problem.
Am I missing something? Is there some way to use environment variables in
Grsync, or am I out of luck?
Thank you for the quick response, Piero! Can this prepending be done in the Grsync app, or does it need to be through the command line? I tried putting sh -c in the "Extra options > Execute this command before rsync" field, and I got this error:
** Launching BEFORE command:
sh -c
Error launching command!
I also tried bash -c, to the same effect. If it needs to be through the command line, then it's redundant and I'm back to square one in that regard.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And for what it's worth, putting just sh or bash in that field doesn't throw an error, but neither does it have any effect on expanding variables.
I feel like I should mention, if it isn't already very obvious, that I'm new to Linux and not a programmer. I'm coming from Windows, and my goal is to set up Linux in such a way that I can deal with it with the minimum possible command-line work in the future. I'm starting to feel like I was spoiled by SyncBack, which presents a very robust set of capabilities graphically that I ended up making use of in complex ways over the years. Recreating something like that in Linux has been a real challenge. I appreciate your patience with my ignorance.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Don't worry: I don't remember how I used to do it years ago 🤣
Maybe someone else recalls?
Anyway, having the command line passed through a shell for expansion is on my todo list.
I just need to make sure there are no possible security issues in the feature.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The reason why running rsync from a shell works is because it's the shell itself expanding the variables.
Normally, grsync runs rsync without passing through a shell, that's why there's no expansion in that case.
I'm planning to add a session checkbox to "pass command through a shell" for that reason; meanwhile, you can do the same by prepending the command with "sh -c", or something like that.
Have a nice day!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm trying to use Grsync on Linux Mint Debian Edition 7 to backup/sync between several drives. I've encountered a major roadblock in the form of environment variables; I want to be able to use the same sessions for multiple users and locations, but when I put those variables in Source and Destination paths (e.g., "/home/$USER/" or "home/%USER%/"), Grsync gives me errors like "change_dir "/home/$USER" failed: No such file or directory". (For the record, I'm using $USER for this example because it's simple and universal - I need to use other variables, some of which I'm creating, so any method that would only get me to the home directory wouldn't suffice.)
In Terminal, rsync can interpret variables fine. But it's beyond my skills and time to figure out how to use the command line to do everything else Grsync does that I need. I've tried.
FreeFileSync can handle variables, but its roadblock is difficulties with modification times on copied files. This is actually my second go at Grsync because it supposedly doesn't have that problem.
Am I missing something? Is there some way to use environment variables in Grsync, or am I out of luck?
Thank you.
Dear Clifford,
The reason why running rsync from a shell works is because it's the shell
itself expanding the variables.
Normally, grsync runs rsync without passing through a shell, that's why
there's no expansion in that case.
I'm planning to add a session checkbox to "pass command through a shell"
for that reason; meanwhile, you can do the same by prepending the command
with "sh -c", or something like that.
Have a nice day!
On Wed, 31 Dec 2025 at 23:52, Clifford Banes cliffordbanes@users.sourceforge.net wrote:
--
Piero Orsoni
orsoni@gmail.com
Thank you for the quick response, Piero! Can this prepending be done in the Grsync app, or does it need to be through the command line? I tried putting
sh -cin the "Extra options > Execute this command before rsync" field, and I got this error:I also tried
bash -c, to the same effect. If it needs to be through the command line, then it's redundant and I'm back to square one in that regard.And for what it's worth, putting just
shorbashin that field doesn't throw an error, but neither does it have any effect on expanding variables.I feel like I should mention, if it isn't already very obvious, that I'm new to Linux and not a programmer. I'm coming from Windows, and my goal is to set up Linux in such a way that I can deal with it with the minimum possible command-line work in the future. I'm starting to feel like I was spoiled by SyncBack, which presents a very robust set of capabilities graphically that I ended up making use of in complex ways over the years. Recreating something like that in Linux has been a real challenge. I appreciate your patience with my ignorance.
Don't worry: I don't remember how I used to do it years ago 🤣
Maybe someone else recalls?
Anyway, having the command line passed through a shell for expansion is on my todo list.
I just need to make sure there are no possible security issues in the feature.
Hi Clifford,
The reason why running rsync from a shell works is because it's the shell itself expanding the variables.
Normally, grsync runs rsync without passing through a shell, that's why there's no expansion in that case.
I'm planning to add a session checkbox to "pass command through a shell" for that reason; meanwhile, you can do the same by prepending the command with "sh -c", or something like that.
Have a nice day!