The behavior of bash depends on the way it is invoked, and it will behave differently if it is invoked as rbash or sh by checking what the command used to run it was.
Code:
RESTRICTED SHELL
If bash is started with the name rbash, or the -r option is supplied at invocation, the shell becomes restricted.
A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically
to bash with the exception that the following are disallowed or not performed:
· changing directories with cd
· setting or unsetting the values of SHELL, PATH, ENV, or BASH_ENV
· specifying command names containing /
· specifying a file name containing a / as an argument to the . builtin command
· Specifying a filename containing a slash as an argument to the -p option to the hash builtin command
· importing function definitions from the shell environment at startup
· parsing the value of SHELLOPTS from the shell environment at startup
· redirecting output using the >, >|, <>, >&, &>, and >> redirection operators
· using the exec builtin command to replace the shell with another command
· adding or deleting builtin commands with the -f and -d options to the enable builtin command
· Using the enable builtin command to enable disabled shell builtins
· specifying the -p option to the command builtin command
· turning off restricted mode with set +r or set +o restricted.
These restrictions are enforced after any startup files are read.
also the same idea applies if it is invoked as sh
Code:
If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as possible,
while conforming to the POSIX standard as well. When invoked as an interactive login shell, or a non-interactive shell with the
--login option, it first attempts to read and execute commands from /etc/profile and ~/.profile, in that order. The --noprofile
option may be used to inhibit this behavior. When invoked as an interactive shell with the name sh, bash looks for the variable
ENV, expands its value if it is defined, and uses the expanded value as the name of a file to read and execute. Since a shell
invoked as sh does not attempt to read and execute commands from any other startup files, the --rcfile option has no effect. A
non-interactive shell invoked with the name sh does not attempt to read any other startup files. When invoked as sh, bash enters
posix mode after the startup files are read.
I was wondering is it possible todo something like following:
A) Settings:-
- 2 servers on the network
- both can be reached via /net/SERVER1/datadir and /net/SERVER2/datadir
- i'm running rsync to syncronize the data coming to server1 from whatever application
B) Wanted:
on other... (2 Replies)
question abt symbolic link ...
i'm doing the following ...
ln -s x.sh ./scripts/y.sh
and
cat ./scripts/y.sh
it is giving following error
cat: cannot open y.sh
Any reason u an think of ?
But it is working fine when i goto scripts directory and cretae the symbolic link.
... (1 Reply)
hello folks
how y'all doin
well i have some questions about symbolic link and hard link
hope some one answer me
i open terminal and join as root
and i wrote ln -s blah blah
then i wrote ls
i see red file called blah blah
but didn't understand what is this can some one explain and... (2 Replies)
**DUP post in Shell Programming and Scripting ***
Hello,
I'm still learning the ins and outs of how to combine multiple Unix commands together (specifically AIX), but I'm looking to do the following (only on local files):
1. Find all symbolic links that are not set up using absolute... (3 Replies)
Hi,
i am trying to create sym links on sles 11 , but it seems i am doing something wrong.
oracle@tests:/u01/app/oracle/oradata/ACIS> pwd
/u01/app/oracle/oradata/ACIS
oracle@tests:/u01/app/oracle/oradata/ACIS> ln -s /db/ACIS/dbase/dbf/ /u01/app/oracle/oradata/ACIS/... (2 Replies)
Hello All,
This may be a silly question to some but I am really stuck.
Is there a way to reverse the following;
sudo rm /bin/sh
sudo ln -s /bin/bash /bin/sh
It was part of a driver compile/installation procedure by Digi for Ubuntu stating that dash isn't supported and a symbolic link... (2 Replies)
Hi All,
I have to set a soft link to a directory, e.g.
it’s done, however I want it make it permanent and in case if any program is pointing to /cms/cmsuat/server/cmu/contribution it should go to /cms/cmsUAT/server/cmu/Contribution. Need your help!
Thanks in advance! (4 Replies)
Hi all,
Can anyone please confirm if the command below is the only way that I can get what the symbolic link is set to?
mnlxd110(oracle)/db/posd2/dba$: ls -l | grep "^l"
lrwxrwxrwx 1 oracle dba 28 Aug 9 2011 bdump -> diag/rdbms/posp1/posp1/trace
mnlxd110(oracle)/db/posd2/dba$:... (7 Replies)
Hi everybody,
I read about treads realted to this issue but they did not resovle issue given below.
Please help me resolve issue given below
I have html file under /srv/www/htdocs/actual_folder
ls actual_folder/
test.html
and following link works... (0 Replies)
Hi, trying to understand more about symblic link, when I compiled a program called "match" in one folder ~/downloadsoftware/I want this program to be accessible like a system command by putting a symbolic link in /usr/bin/ Not by setting the $PATH method in .bashrc at this time.
What I did is:... (4 Replies)
Discussion started by: yifangt
4 Replies
LEARN ABOUT SUNOS
shells
shells(4) File Formats shells(4)NAME
shells - shell database
SYNOPSIS
/etc/shells
DESCRIPTION
The shells file contains a list of the shells on the system. Applications use this file to determine whether a shell is valid. See getuser-
shell(3C). For each shell a single line should be present, consisting of the shell's path, relative to root.
A hash mark (#) indicates the beginning of a comment; subsequent characters up to the end of the line are not interpreted by the routines
which search the file. Blank lines are also ignored.
The following default shells are used by utilities: /bin/bash, /bin/csh, /bin/jsh, /bin/ksh, /bin/pfcsh, /bin/pfksh, /bin/pfsh, /bin/sh,
/bin/tcsh, /bin/zsh, /sbin/jsh, /sbin/sh, /usr/bin/bash, /usr/bin/csh, /usr/bin/jsh, /usr/bin/ksh, /usr/bin/pfcsh, /usr/bin/pfksh,
/usr/bin/pfsh, and /usr/bin/sh, /usr/bin/tcsh, /usr/bin/zsh. Note that /etc/shells overrides the default list.
Invalid shells in /etc/shells may cause unexpected behavior (such as being unable to log in by way of ftp(1)).
FILES
/etc/shells lists shells on system
SEE ALSO vipw(1B), ftpd(1M), sendmail(1M), getusershell(3C), aliases(4)SunOS 5.10 4 Jun 2001 shells(4)