close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": /usr/lib/python2.7/dist-packages/libsvn/_repos.so: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
2010-07-22
- [備忘] 重新改用 root 身份執行的 shell script
[ "`id -u`" != "0" ] && exec sudo su -c "$0" "$@"
- [備忘] 讓標準輸出(STDOUT)與標準錯誤(STDERR)導入到 log 檔的 bash script 寫法
#! /bin/bash
TARGET="target-file"
# file descriptor 4 prints to STDOUT and to TARGET
exec 4> >(while read a; do echo $a; echo $a >>$TARGET; done)
# now STDOUT is redirected
exec >&4
exec 2>&4
date
echo "Date sent to fd4."
abc
Download in other formats: