Can anyone help me with a shell script in unix(in bash shell) for copying a file from one location(i.e a directory), to other, without using cp command at all(not using it in the script also.Any other command /utility can be used in the script).Can it be really done ? I could'nt find a way ou开发者_运维百科t.Any help would be appreciated...
Presumably you can cat
and redirect the output. Since this sounds like homework, I'll leave it to you to work out the exact syntax.
How many options do you want?
- rcp
- scp
- dd
- perl
- python
- cat
- while / read / echo
That is nowhere near exhaustive. You can be creative...have fun!
You could use:
cat
to create a C source file, copy.cmake
orcc
to compile it- And then run it to do the copying.
You could use:
- cat /usr/bin/cp > x
- chmod +x x
- ./x old new
But that is probably cheating.
Erghm. Why?! Anyway...
cat file1 > some/other/dir/file2
install
is a good one.
精彩评论