LDP/LDP/guide/docbook/abs-guide/psub.bash

23 lines
449 B
Bash

#!/bin/bash
# psub.bash
# As inspired by Diego Molina (thanks!).
declare -a array0
while read
do
array0[${#array0[@]}]="$REPLY"
done < <( sed -e 's/bash/CRASH-BANG!/' $0 | grep bin | awk '{print $1}' )
# Sets the default 'read' variable, $REPLY, by process substitution,
#+ then copies it into an array.
echo "${array0[@]}"
exit $?
# ====================================== #
bash psub.bash
#!/bin/CRASH-BANG! done #!/bin/CRASH-BANG!