On Friday 05 September 2003 12:50 am, Linux Mailing lists account wrote:
Thanks again for the suggestion. You've kept me persuing this!
After experimenting, then reading the man pages for bash, I found out a couple things.
Aliases don't allow for passing arguments. You are supposed to used shell funtions for that.
O.K. Now how do I translate my command string into a shell function that works?
tardy () { (cd $1; tar cf - .) | (cd $2; tar xpfS - ); } ??????
No. This completely fails, because piping doesn't appear to work in shell functions. (I really didn't expect it would.) In fact, this makes a horrible mess with tar trying to extract back into the source directory structure.
So, How do I write a shell function to do what I want???
I don't know; I don't use them much (but maybe I should). How about just write it as a shell script? I know, it's lacking the glory and fun of solving the problem, *and* it's a wee bit slower, but it'll certainly work. :-) #!/bin/sh cd $1; tar cf - . | ( cd $2; tar xpfS - ) -NIck