History of commands csh

I can select the commands using the arrow only in root and the user can't do it. How to make the user's select of commands by arrow?
I did csh.cshrc:
Code:
set savehist = (8192 merge)
set savedirs = 100
set tperiod = 10
alias   periodic        '(history -S & dirs -S & )'
dirs -L
history -M # workaround for ssh(1) logins

Did not help
 
First of all check the output of echo $0 to make sure the user is actually using t/csh.

/etc/csh.cshrc is a system-wide configuration. As a personal preference I usually leave it alone and only modify the individual .cshrc files, e.g. /root/.cshrc, /home/pavlar/.cshrc, etc.

What you're looking for are the history-search-backward and history-search-forward commands that are bound to the up and down keys. They may be missing in your RC file. Check the reference RC in the source tree (lines 40 and 41).
 
Excuse me, this is strange, but I have user's shell:
Code:
 echo $SHELL
/bin/sh
root's shell
Code:
 echo $SHELL
/bin/tcsh
User's .shrc
Code:
alias h='fc -l'
alias j=jobs
alias m="$PAGER"
alias ll='ls -laFo'
alias l='ls -l'
alias g='egrep -i'
 
In user's .shrc script of reference dont work
Code:
if ($?prompt) then
                # An interactive shell -- set some stuff up
                set prompt = "%N@%m:%~ %# "
                set promptchars = "%#"

                set filec
                set history = 1000
                set savehist = (1000 merge)
                set autolist = ambiguous
                # Use history to aid expansion
                set autoexpand
                set autorehash
                set mail = (/var/mail/$USER)
                if ( $?sh ) then
                        bindkey "^W" backward-delete-word
                        bindkey -k up history-search-backward
                        bindkey -k down history-search-forward
                endif

        endif


Code:
-sh: Syntax error: "(" unexpected (expecting "fi"
 
And I can't changing user sh to tcsh in /etc/passwd - sh does not change
Code:
cat /etc/shells
# $FreeBSD: releng/12.1/lib/libc/gen/shells 336840 2018-07-28 20:21:23Z brd $
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/sh
/bin/csh
/bin/tcsh
/usr/local/bin/tcsh
/usr/local/bin/bash
/usr/local/bin/rbash
 
I added a new user and chose tcsh. Here everything is in order by arrow's selecting of history of commands.. This decision suits me. Thank. And with the previous user, nothing happens . I will remove it so as not to waste time
 
I use only nano or editor mc or ee .Vi is very uncomfortable.
Set the EDITOR variable to a different editor, then vipw(8)/vigr(8) will use that editor.

Code:
If	the following environment variable exists it will be utilized by vipw:

     EDITOR	      The editor specified by the string EDITOR	will be	in-
		      voked instead of the default editor vi(1).  This can be
		      used to allow a script to	non-interactively modify the
		      password file.
 
vi is used by default unless you specify different editor in .profile

but again instead of editing the file it's very easy just to type

chsh -s /bin/csh
and after you relog your new shell will be csh
 
Yes his user is using /bin/sh which is controlled by ~/.profile when he switch to csh he's env will be read by ~/.cshrc that's why for his user he must specify the env using .profile file.

 
Thanks. But I just don’t like the look of the invitation :~ % . Can In somehow transform it?


Code:
 ku@risk:~ % echo $0
-tcsh
ku@risk:~ %
 
Code:
 set prompt="%{^[[40;33;1m%}[%T] %{^[[40;32;1m%} %/ >"
[1] 4280
[15:55]  /home/ku >
👍
 
Code:
        switch($TERM)
                case "rxvt":
                case "screen*":
                case "xterm*":
                        set TITLE = "%{\033]0;%n@%m:%~\007%}"
                        breaksw
                default:
                        set TITLE = ""
                        breaksw
        endsw

        set prompt = "${TITLE}%B%n@%m%b:%c03 %# "
        unset TITLE
This sets the Xterm/PuTTY title the same as the prompt.
 
Where to write this expression ( set prompt="%{^[[40;33;1m%}[%T] %{^[[40;32;1m%} %/ >") for tcsh? In my directory, only /.cshrc

Code:
 ls -la
total 56
drwxr-xr-x  3 ku    ku      512 May  4 16:02 .
drwxr-xr-x  5 root  wheel   512 May  4 11:58 ..
-rw-------  1 ku    ku       12 May  4 16:02 .cshdirs
-rw-r--r--  1 ku    ku     1107 May  4 16:02 .cshrc
-rw-------  1 ku    ku     2960 May  4 16:02 .history
-rw-r--r--  1 ku    ku      392 May  4 11:36 .login
-rw-r--r--  1 ku    ku      163 May  4 11:36 .login_conf
-rw-------  1 ku    ku      379 May  4 11:36 .mail_aliases
-rw-r--r--  1 ku    ku      339 May  4 11:36 .mailrc
drwxr-xr-x  2 ku    ku      512 May  4 11:39 .mc
-rw-r--r--  1 ku    ku      954 May  4 11:36 .profile
-rw-r--r--  1 ku    ku      851 May  4 11:36 .shrc
-rwxr-xr-x  1 ku    ku      159 Feb 12 10:19 ban
-rwxr-xr-x  1 ku    ku      834 Jun 18  2019 cleaner
 
I put to .cshrc It works
Code:
# freebsd-update upgrade -r ${name_of_release}

        -- Lars Engels <lme@FreeBSD.org>
[16:13]  /home/ku >
 
Back
Top