开发者

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

开发者 https://www.devze.com 2023-01-30 13:24 出处:网络
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

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:

  1. cat to create a C source file, copy.c
  2. make or cc to compile it
  3. And then run it to do the copying.

You could use:

  1. cat /usr/bin/cp > x
  2. chmod +x x
  3. ./x old new

But that is probably cheating.


Erghm. Why?! Anyway...

cat file1 > some/other/dir/file2


install is a good one.

0

精彩评论

暂无评论...
验证码 换一张
取 消