View previous topic :: View next topic |
Author |
Message |
manowar_2005 n00b
Joined: 09 Jun 2005 Posts: 12
|
Posted: Thu Jun 30, 2005 7:00 pm Post subject: Проблемы со скриптами |
|
|
Есть скрипт
Code: |
#!/bin/sh
HELP="Using: $0 IP_address \"text message\""
if [ -z $1 ]; then
echo ${HELP}
exit
fi
NAME=`nmblookup -A $1 | grep "<" | head -1 | cut -d" " -f1`
if [ "_${NAME}" != _"" ]; then
echo NetBIOS name: ${NAME}
if [ -z "$2" ]; then
nmblookup -A $1 | grep "<"
echo ${HELP}
exit
else
echo Sending message
echo $2 | smbclient -M ${NAME} -I $1 1>./$$.tmp 2>&1
tail -1 ./$$.tmp
rm ./$$.tmp
fi
else
echo Host not found
exit
fi
|
раньше пользовался, а теперь выдает такую ошибку
Code: |
head: `-1' option is obsolete; use `-n 1' since this will be removed in the future
|
естественно ничего не работает., сейчас система на AMD64. |
|
Back to top |
|
|
viy Veteran
Joined: 03 Jul 2004 Posts: 1580 Location: Riga, Latvia
|
Posted: Thu Jun 30, 2005 7:06 pm Post subject: |
|
|
Все написано.
Надо "head -1" заменить на "head -n 1", почитай man. |
|
Back to top |
|
|
dish Apprentice
Joined: 19 Dec 2004 Posts: 266 Location: Moscow, Russia
|
Posted: Thu Jun 30, 2005 7:08 pm Post subject: |
|
|
То есть ты пробовал так в скрипте писать:
Quote: | NAME=`nmblookup -A $1 | grep "<" | head -n 1 | cut -d" " -f1` |
???
[edit]
viy уже опередил меня
[/edit] _________________ Contrary to popular belief, UNIX is user-friendly. It just happens to be very selective about who it decides to make friends with. A. Haiut. |
|
Back to top |
|
|
|