mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-06 02:02:42 +02:00
Imported from ../bash-2.04.tar.gz.
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
exec 9<>/dev/tcp/129.22.8.162/25
|
||||
|
||||
read banner <&9
|
||||
echo "$banner"
|
||||
|
||||
echo quit >&9
|
||||
|
||||
read msg <&9
|
||||
echo "$msg"
|
||||
|
||||
exec 9<&-
|
||||
|
||||
# nifty date command that queries the date/time server
|
||||
cat < /dev/tcp/129.22.8.102/13
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,11 @@
|
||||
# interactive
|
||||
|
||||
# from tty
|
||||
read -n 3 -p 'enter three chars: ' xyz
|
||||
echo
|
||||
echo $xyz
|
||||
|
||||
# using readline
|
||||
read -p 'enter 3 chars: ' -e -n 3 abc
|
||||
# readline outputs a newline for us, so we don't need the extra echo
|
||||
echo $abc
|
||||
@@ -0,0 +1,25 @@
|
||||
#! /bin/bash
|
||||
|
||||
i=0
|
||||
while [ $i -lt $1 ]
|
||||
do
|
||||
/bin/sh -c "sleep 4; exit 0" &
|
||||
rv=$?
|
||||
pid=$!
|
||||
eval bg_pid_$i=$pid
|
||||
echo $$: Job $i: pid is $pid rv=$rv
|
||||
i=$((i + 1))
|
||||
done
|
||||
|
||||
|
||||
|
||||
i=0
|
||||
while [ $i -lt $1 ]
|
||||
do
|
||||
eval wpid=\$bg_pid_$i
|
||||
echo Waiting for job $i '('pid $wpid')'
|
||||
wait $wpid
|
||||
rv=$?
|
||||
echo Return value is $rv
|
||||
i=$((i + 1))
|
||||
done
|
||||
Reference in New Issue
Block a user