Issue
For example, I have defined a zsh-script called "myCmd.sh" when I run
myCmd --op1 "/p1/p2" --op2 "/p3/p4" -op3 "a"
Cmd --op1 "/mnt/d/p1/p2" --op2 "/mnt/d/p3/p4" -op3 "a"
In other words, once a path string occurred in the command parameters, the prefix "/mnt/d" will be added, the cmd and other args or parameters will remain the same.
Solution
You can use static named directories to have filename expansion produce the desired path, saving you a little typing. For example,
d=/mnt/d
cmd --opt1 ~d/p1/p2 --op2 ~d/p3/p4
is the same as
cmd --opt1 /mnt/d/p1/p2 --op2 /mnt/d/p3/p4
~name
, where name
is any parameter with a value that starts with /
, is expanded to the value of the parameter.
An example:
% echo ~d
zsh: no such user or named directory
% d=/mnt/d
% echo ~d
/mnt/d
Answered By - chepner Answer Checked By - Mildred Charles (WPSolving Admin)