Erratic behaviour from Fn keys

bash is not just a command-line shell; it’s also a script interpreter. And a shell function can handle variables. So you can write a shell function — which, once export’ed, will be available in all bash subshells — which behaves as an internal shell command and takes/processes command-line arguments.

As an example… :point_down:

name_of_function ()
{
  if [ $1 = "something" ]
  then
    command_1
    command_2
    ...
  else
    command_3
    ...
  fi
}

export -f name_of_function
1 Like