GNU/Linux >> Linux Esercitazione >  >> Linux

Shopt:Not Found [Nessun file o directory di questo tipo]

Il problema

Quando un utente accede al terminale utilizzando un utente con la shell korn (ksh) vengono visualizzati i seguenti messaggi:

Shopt: Not Found [No Such File Or Directory]

La soluzione

La riga seguente è stata aggiunta su /etc/profile :

shopt -s histappend

Nota :
/etc/profile è un file di configurazione che imposta l'ambiente globale per tutti gli utenti. Come da pagina man di shopt:

# man shopt

 shopt is part of BASH_BUILTINS
        -s  Display readline key sequences bound to macros and the strings they output in such 
            a way that they can be re-read.

        histappend
            If set, the history list is appended to the file named by the value of the 
            HISTFILE variable when the shell exits, rather than overwriting the file

Il problema riguarda KSH poiché shopt fa parte di BASH_BUILTINS . Come da /etc/passwd file la shell dell'utente è "ksh" e non "bash":

# grep -i test /etc/passwd
testuserX:x:54322:54323::/home/testuserX:/bin/bash
test1:x:54323:112::/home/test1:/bin/ksh

==============
/etc/profile :
==============

47 TMOUT=14400
48 HOSTNAME=`/bin/hostname 2>/dev/null`
49 HISTSIZE=1000
50 HISTTIMEFORMAT='%F.%T '
51 shopt -s histappend   <===============================  Line was added

Se passiamo a test utente troveremo i seguenti messaggi:

# su - test1
/etc/profile[277]: shopt: not found [No such file or directory]

Soluzione 1

1. Modifica il file /etc/profile e Commenta la riga 51:shopt -s histappend:

# vi /etc/profile
#shopt -s histappend

2. Ricarica il profilo o esci dal terminale ed effettua nuovamente il login.

# source /etc/profile .

3. Accedi di nuovo:

# su - test1
$
$ whoami
test1
Nota :Se è necessario utilizzare questa riga shopt -s histappend per un utente specifico come root, si consiglia di utilizzare quell'opzione su bash_profile per l'utente root o qualsiasi altro utente che utilizza bash come predefinito.

Ad esempio :

# cat /root/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
  . ~/.bashrc
fi

Ambiente specifico dell'utente e programmi di avvio:

PATH=$PATH:$HOME/bin
shopt -s histappend
export PATH
export HISTTIMEFORMAT="%

Rimuovilo da /etc/profile:

# cat /etc/profile| grep -i shopt
#

Soluzione 2

Cambia la shell da ksh a bash per user test1 .

1. Verifica le tue correnti Shell:

# chsh -l test1
/bin/sh
/bin/bash
/sbin/nologin
/bin/dash
/bin/tcsh
/bin/csh
/bin/ksh

2. Cambialo in bash

# chsh -s /bin/bash test1
Changing shell for test1.
Shell changed.
# cat /etc/passwd|grep -i test1
test1:x:54323:112::/home/test1:/bin/bash
#

3. Verifica e testa la nuova shell:

# su - test1
$ whoami
test1
$


Linux
  1. Errore:Tcl.h non trovato (nessun file o directory di questo tipo)?

  2. mkfs.hfsplus:comando non trovato

  3. id:comando non trovato

  4. w:comando non trovato

  5. mkfs:comando non trovato

dos2unix:comando non trovato

nano:comando non trovato

chmod:comando non trovato

ordina:comando non trovato

sed:comando non trovato

Lo script SH in $PATH non è stato trovato su Linux Alpine 3.11