Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Проблемы со скриптами
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Russian
View previous topic :: View next topic  
Author Message
manowar_2005
n00b
n00b


Joined: 09 Jun 2005
Posts: 12

PostPosted: Thu Jun 30, 2005 7:00 pm    Post subject: Проблемы со скриптами Reply with quote

Есть скрипт

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
View user's profile Send private message
viy
Veteran
Veteran


Joined: 03 Jul 2004
Posts: 1580
Location: Riga, Latvia

PostPosted: Thu Jun 30, 2005 7:06 pm    Post subject: Reply with quote

Все написано.

Надо "head -1" заменить на "head -n 1", почитай man.
Back to top
View user's profile Send private message
dish
Apprentice
Apprentice


Joined: 19 Dec 2004
Posts: 266
Location: Moscow, Russia

PostPosted: Thu Jun 30, 2005 7:08 pm    Post subject: Reply with quote

То есть ты пробовал так в скрипте писать:
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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Russian All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum