How to copy (save as) one file into multiple files (names are different)
I have a file temp.sh. I would like to save temp.sh as temp1.sh, Temp.sh, TEMP.sh, and a.sh. I am trying to use
Code:
cp temp.sh temp1.sh Temp.sh TEMP.sh a.sh |
No, it doesn't. It doesn't work like that.
If you look at the error message it should be something like... Code:
cp: target 'a.sh' is not a directory |
You could try this:
Code:
echo -en "t1.sh\0t2.sh\0tn.sh\0"|xargs -0 -I '{}' cp /tmp/x.sh /tmp/'{}' Args to xargs are -0 use '0' as delimiter, -I '{}' replace '{}' with data read from stdin. The \0 in the echo string inserts a 0, the byte NOT the character into the string. |
Would a simple loop do?
Code:
for f in temp1 Temp TEMP a; do |
That's the beauty of linux if you dont like one solution just hang around another one will be along in a moment.
|
All times are GMT -5. The time now is 12:10 AM. |