Created
February 28, 2012 11:31
-
-
Save Flackus/1932042 to your computer and use it in GitHub Desktop.
okay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
logfile=logfile.txt | |
{ | |
echo -e "Текущее время:\n`date`" | |
echo -e "\nПользователи в системе:\n`who`" | |
echo -e "\nТекущий аптайм:\n`uptime`" | |
} > "$logfile" | |
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
logfile=logfile.txt | |
# Связать дескриптор #6 с stdout | |
exec 6>&1 | |
# stdout замещается файлом logfile | |
exec > $logfile | |
echo -e "Текущее время:\n`date`" | |
echo -e "\nПользователи в системе:\n`who`" | |
echo -e "\nТекущий аптайм:\n`uptime`" | |
# Восстановить stdout и закрыть дескриптор #6 | |
exec 1>&6 6>&- | |
echo "Вывод завершен, stdout восстановлен" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment