Hi-
Newbie here with some basic questions:
1) I can't get alias to work. I tried alias ll='ls -al', but it doesn't work. When just typing 'alias', the new definition doesn't appear. I'm in a bash shell -- is that the problem. I tried switching to csh, but that didn't seem to help. This brings me to my second question.
2) How can I tell what shell I am in? I thought I was in the bash shell so I typed "csh". The shell prompt remained as $.
Thanks
I'm in the BASH shell, and your alias works fine for me. Are you using BASH, or just sh?
Also, are you using these aliases in the shell, or in a script? Aliases are usually turned off in scripts, but you can enable them with 'shopt -s expand_aliases'.
You can tell what shell you're in like this:
$ echo "${SHELL}"
/bin/bash
$
'echo $0' will give you your 'current' shell interpreter.
no, this doesn't work.
$ echo $0
-bash
$ echo $SHELL
/usr/local/bin/bash
$ csh
>echo $0
csh
>echo $SHELL
/usr/local/bin/bash
>
quoting ''man bash':
SHELL The full pathname to the shell is kept in this environment vari-
able. If it is not set when the shell starts, bash assigns to
it the full pathname of the current user's login shell.
'SHELL' holds the user 'login shell' - which does not change when you change your shell interpreter [bash -> csh]. WHereas '$cho $0' gives you your current shell interpreter in a given shell [regardless of your 'login shell'].