scp not accept parameters in shell script
Hello everybody.
I am working with a Ubuntu PC and a lot of Raspberry PI's around me. All raspis are root because using all GPIO. All Computer has keypairs to each other. So no more passwd is needed. I try to make copy more easy. alias t102='scp test.txt root@192.168.1.102:/root' t102 test.txt 100% 63 0.1KB/s 00:00 klaus=test.txt alias t101='scp $klaus root@192.168.1.102:/root' t101 test.txt 100% 63 0.1KB/s 00:00 up to here all is running well. Now try to give parameter to scp alias t101='scp $1 root@192.168.1.102:/root' t101 test.txt scp: /root: not a regular file How can I solve this problem? regards oldfreak |
You can't pass arguments to an alias like that, the arguments will always come at the end. You will need to make a function instead. The 2nd answer here might be exactly what you are looking for: http://stackoverflow.com/questions/4...riable-in-bash
|
Quick and not dirty!
@ af7567
Thank You very much. It works as it is written there. And, thank you more, I learned about to handle C-Code:-) regards from Germany oldfreak |
All times are GMT -5. The time now is 07:07 AM. |