-
Notifications
You must be signed in to change notification settings - Fork 1
Bash Tips
twang15 edited this page Sep 22, 2021
·
4 revisions
${string%substring} # Deletes shortest match of $substring from back of
${0%/*} Assuming $0 is a file name, it will give you the directory it is located in. It works the same way as the dirname command.
${0##*/} Assuming $0 is a file name, it will give you the file name without the leading path. It works the same way as the basename command.
#### run processes and store pids in array
for i in $n_procs; do
./procs[${i}] &
pids[${i}]=$!
done
####wait for all pids
for pid in ${pids[*]}; do
wait $pid
done