How to get error output and store it in a variable or file

后端 未结 3 1754
耶瑟儿~
耶瑟儿~ 2021-01-14 11:31

I\'m having a little trouble figuring out how to get error output and store it in a variable or file in ksh. So in my script I have cp -p source.file destination

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-14 11:58

    You can do STDERR redirects by doing:

    command 2> /path/to/file.txt
    

提交回复
热议问题