|
|
| ��� �������� �������� �� ��������� ������: English Castellano ChineseGB Deutsch Francais Italiano Nederlands Russian Turkce |
������ Katja � Guido Socher <katja(at)linuxfocusorg, guido(at)linuxfocus.org> �� �������: Katja �������� �������� ������. �� �������� Tux, ������ & ���������� � ����. �� �������� �������� ����������� �����. Guido ����� ���������� Linux � ��� �������� ��� ��, ������, ��� ��� ��������������� ���������� ��������������� � ��������� ������. ��� ���� �� ������ ������ �� �������� �� "open source". ��� �������� �������� ����� linuxfocus.org/~guido. ������� �� �������: Kirill Pukhlyakov <kirill(at)linuxfocusorg> ����������: |
������:
Xdialog � dialog ��� ������������ ������� ��� ���������� ������������
���������� � ����� shell ��������.
��� ��������� ���� ��� ��������� ��������� ���� ���������������� shell.
�� ������ ������� �������� ��� �������
Shell Programming.
bash
Xdialog --yesno "Do you want to learn more about Xdialog?" 0 0;\
case $? in
0)
echo "Result: Yes chosen.";;
1)
echo "Result: No chosen.";;
255)
echo "ESC pressed.";;
esac
dialog --help
���
Xdialog --help
dialog --yesno "text string" <height> <width>
������ dialog ��� Xdialog ��� ���� ���� ��� ���� � �������� ���������.
#!/bin/sh
#
#DIALOG=Xdialog
DIALOG=dialog
#
# name of your default isp:
defaultisp=maxnet
#
error()
{
echo "$1"
exit 2
}
help()
{
cat <<HELP
pppdialout -- select an ISP and dial out.
All available ISPs must have a config file in /etc/ppp/peers
pppdialout executes the ppp-on/ppp-off scripts as described
in http://linuxfocus.org/English/March2001/article192.shtml
pppdialout, copyright gpl, http://linuxfocus.org/English/November2002
HELP
exit 0
}
# parse command line:
while [ -n "$1" ]; do
case $1 in
-h) help;shift 1;; # function help is called
--) shift;break;; # end of options
-*) echo "error: no such option $1. -h for help";exit 1;;
*) break;;
esac
done
tempfile=/tmp/pppdialout.$$
trap "rm -f $tempfile" 1 2 5 15
# check if we have a ppp network interface
if /sbin/ifconfig | grep '^ppp' > /dev/null; then
# we are already online
$DIALOG --title "go offline" --yesno "Click YES to \
terminate the ppp connection" 0 0
rval="$?"
clear
if [ "$rval" = "0" ]; then
echo "running /etc/ppp/scripts/ppp-off ..."
/etc/ppp/scripts/ppp-off
fi
else
# no ppp connection found, go online
# get the names of all available ISP by listing /etc/ppp/peers
for f in `ls /etc/ppp/peers`; do
if [ -f "/etc/ppp/peers/$f" ]; then
isplist="$isplist $f =="
fi
done
[ -z "$isplist" ]&&error "No isp def found in /etc/ppp/peers"
#
$DIALOG --default-item "$defaultisp" --title "pppdialout" \
--menu "Please select one of\
the following ISPs for dialout" 0 0 0 $isplist 2> $tempfile
rval="$?" # return status, isp name will be in $tempfile
clear
if [ "$rval" = "0" ]; then
isp=`cat $tempfile`
echo "running /etc/ppp/scripts/ppp-on $isp..."
/etc/ppp/scripts/ppp-on "$isp"
else
echo "Cancel..."
fi
rm -f $tempfile
fi
# end of pppdialout
��� �������� ������ :dialog --menu "text" <height> <width> <menu height> <tag1> <description> ...
�������������� <height>, <width> � <menu height> ����� ( ����������, ��. ���� ) ����� ���������� ������� ������ (<tag1> <description>). �� �������� ����� ���������� ( == ). ������ ���������� isplist �������� ��� :isp1 == isp2 == isp3 ==
��������� ������ ������������ ��������� � ����������� ����� ������. �� ������� "2> $tmpfile" �������������� ��� � ��� ��������� ���� ( tmpfile ). ���� ���� ��������� ������� �������� "cancel". ������� ��� ���� �������������� ���������� $?, ����� ����� ����� ������������.![[pppdialout with xdialog]](../../common/images/article267/xdialog_1.gif)
![[pppdialout with xdialog]](../../common/images/article267/xdialog_2.gif)
![[pppdialout with dialog]](../../common/images/article267/dialog_1.gif)
![[pppdialout with dialog]](../../common/images/article267/dialog_2.gif)
mktgz yourpackage .
������������ ��� ����� � ������� �������� ( "." ) � ��� ��������������� ����������� ������� ��, ������� �� ������ ��������� � ����� yourpackage.tar.gz. �� ������ ������� ��� ����� ( mktgz.txt ) �� ����� ��� ��������� ��������� - �� � ���� ��� ���������� ������, ����� ������ ��� �� ��������.grep -i "somestring" file.txt | sort | uniq | wc -l( ��� ���, ��� ��� �� ����� ������ ��� ������� : ����� �������������� ���������� ������ � ����� file.txt, ������� �������� ������ "somestring")
|
|
Webpages maintained by the LinuxFocus Editor team
© Katja and Guido Socher, FDL LinuxFocus.org |
Translation information:
|
2002-11-03, generated by lfparser version 2.31