GNU/Linux >> Linux Esercitazione >  >> Linux

Come posso annullare l'impostazione o eliminare una funzione bash?

Il non impostato Il comando integrato accetta un'opzione, -f , per eliminare le funzioni:

unset -f foo

Forma il non impostato voce nella bash manpage:

Se viene specificato -f, ogni nome fa riferimento a una funzione di shell e la definizione della funzione viene rimossa.

Nota:-f è veramente necessario solo se esiste una variabile con lo stesso nome. Se non hai anche una variabile chiamata foo , quindi unset foo eliminerà la funzione.


Vedi help unset :

unset: unset [-f] [-v] [-n] [name ...]

Unset values and attributes of shell variables and functions.

For each NAME, remove the corresponding variable or function.

Options:
  -f    treat each NAME as a shell function
  -v    treat each NAME as a shell variable
  -n    treat each NAME as a name reference and unset the variable itself
    rather than the variable it references

Without options, unset first tries to unset a variable, and if that fails,
tries to unset a function.

Some variables cannot be unset; also see `readonly'.

Exit Status:
Returns success unless an invalid option is given or a NAME is read-only.

Non c'è né unset --helpman unset purtroppo.


Linux
  1. `^m` E come sbarazzartene?

  2. Come chiamare una funzione Bash nello script Bash all'interno di Awk?

  3. Come ottenere il Tty in cui è in esecuzione Bash?

  4. Come ottenere lo stato di uscita un ciclo in bash

  5. Come ottenere la data/ora di creazione del file in Bash/Debian?

Funzione Bash e come usarla {Variabili, argomenti, ritorno}

Funzioni Bash

Come ottenere solo l'ID del processo nello specificare il nome del processo in Linux?

Come ottenere netmask da bash?

Come ottenere il nome dell'utente da uid

Come posso eliminare i socket nello stato FIN_WAIT1?