Re: Start a daemon, show a syntax error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



2012/3/20 Tom Gundersen <teg@xxxxxxx>:
> 2012/3/20 郑文辉(Techlive Zheng) <techlivezheng@xxxxxxxxx>:
>> But 'ls -l /bin/sh', shows that sh is a symlink to bash, but why it
>> behaves so differently?
>>
>>    lrwxrwxrwx 1 root root 4 2011-11-23 14:08 /bin/sh -> bash
>
> When called as "/bin/sh", bash works in compatibility mode.
> Initscripts only support bash being called as "bash".
>
> To find out more, Google is your friend :-)
>
> -t

Thank you, I thought it is related with this issue, so just ask here,
next time, I will do my research first.

I think I found the cause of my problem, it turns out I am using an
very old /etc/profile. I move the /etc/profile to /etc/profile.bak and
reinstall the filesystem package, then I diff the /etc/profile and
/etc/profile.bak. I found my previous version of /etc/profile using
the some sort of guess mechanism to find the shell that is using and
'sh' is the default value of $SHELL which may cause the last line of
'source /etc/bash-completion' running in compatibility mode.

Here is the diff output.

	diff /etc/profile.bak /etc/profile

	2,25d1
	< #
	< # This file is intended to be used for ALL common
	< # Bourne-compatible shells. Shell specifics should be
	< # handled in /etc/profile.$SHELL where $SHELL is the name
	< # of the binary being run (discounting symlinks)
	< #
	< # Sections taken from SuSe's /etc/profile
	< # Note the explicit use of 'test' to cover all bases
	< #  and potentially incompatible shells
	<
	< #Determine our shell without using $SHELL, which may lie
	< shell="sh"
	< if test -f /proc/mounts; then
	<    case $(/bin/ls -l /proc/$$/exe) in
	<         *bash) shell=bash ;;
	<         *dash) shell=dash ;;
	<         *ash)  shell=ash ;;
	<         *ksh)  shell=ksh ;;
	<         *zsh)  shell=zsh ;;
	<     esac
	< fi
	<
	< # Load shell specific profile settings
	< test -f "/etc/profile.$shell" &&  . "/etc/profile.$shell"
	31c7
	< PATH="/bin:/usr/bin:/sbin:/usr/sbin"
	---
	> PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
	34,46d9
	< # Export default pkg-config path
	< PKG_CONFIG_PATH="/usr/lib/pkgconfig"
	< export PKG_CONFIG_PATH
	<
	< # Some readline stuff that is fairly common
	< HISTSIZE=1000
	< HISTCONTROL="erasedups"
	<
	< INPUTRC="/etc/inputrc"
	< LESS="-R"
	<
	< export HISTSIZE HISTCONTROL INPUTRC LESS
	<
	50c13
	< 		test -x $profile && . $profile
	---
	> 		test -r "$profile" && . "$profile"
	65,66d27
	<
	< source /etc/bash_completion


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux