2
以下のように、ファイルok.log
ではなく、画面に出力するのはecho "this is to stdout"
です。どうすればいいですか?
私はexec
シェルコマンドの使用方法を探したが、結果なしで、私に"exec 1> ok.log"を使用する場合、シェルスクリプト内の指定されたコンテンツを画面に出力するにはどうすればよいですか?
[[email protected] tmp]# bash --version
GNU bash, version 4.2.46(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2011 Free Software Foundation, Inc.
[[email protected] tmp]# cat 2.sh
#!/bin/bash
exec 1>ok.log
exec 2>error.log
#exist dir
ls /home/
#no exist dir
ls /etca/
#to stdout
echo "this is to stdout"
#other cmds
...