3

I have this alias in .bashrc:

alias clone='while ! rsync --rsh=ssh -avP --delete --stats --compress-level=9 $1/ $2:$3 | grep -q "Number of files transferred: 0" ; do echo -n .; sleep 1; done'

Got error when I do this:

clone /d/root/tmp [email protected] /temp
bash: syntax error near unexpected token `/d/root/tmp'

Everything works fine if I put this in a script file:

#!/bin/sh
while ! rsync --rsh=ssh -avP --delete --stats --compress-level=9 $1/ $2:$3 | grep -q "Number of files transferred: 0" ; do echo -n .; sleep 1; done

and execute the script file like so:

./clonescript /d/root/tmp [email protected] /temp

Any help is much appreciated.

1 Answer 1

3

Aliases do not have positional arguments. create a function instead.

clone() {
  while ...
   ...
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.