BASH scripting

Add ~/bin to path e.g.

Time/Date

pipe stdout and stderr to two different processes in shell script?

Description of bash components used in script below.

"$@"

set -- "$@" "$1"

shift

$#

Here is an example that filters a specific parameter (e.g --values=xyz). It loops through all of them adding the ones we want to keep to the end and shifting left dropping the first one every-time.

argc=$#
j=0
while [ $j -lt $argc ]; do
    case "$1" in
         --values=?*)
              # do nothing remove this
              ;;
         *)
              set -- "$@" "$1"
              ;;
    esac

    shift
    j=$((j + 1))
done

Bash arrays(list) associative arrays(maps/dict)

 printf '\n%.s' {1..100} 

...


CategoryLinux

Linux/Bash (last edited 2023-09-08 20:53:50 by PieterSmit)