# /bin/sh - aliases



## df (Nov 5, 2012)

Hi,

I've started to use FreeBSD recently, and so far I think I can ditch the alternatives! I didn't even want to install bash, but to try use the default shell instead, just for the kicks. There's a small issue with aliases though, and I'm sorry if this has already been ranted before.


```
$alias ls='ls -G'
$alias
ls='ls -G'
$ls
...
$alias ls='ls -G'
$alias
ls='ls -'
$ls
ls -: command not found.
```

Happens on FreeBSD-9.0 RELEASE, and 9.1-RC3 source seems the same. This is especially nasty after re-sourcing ~/.profile, or where ever you keep aliases, you will notice that all previously hashed aliases are now broken. Oddly there was fairly simple way of seemingly fix it, but I can't stop thinking that this would have been done unless it was just dumb :r So if anyone is interested to check it out, be my guest.


----------



## wblock@ (Nov 5, 2012)

sh(1) is very bare-bones.  It only recently got command history.

You don't have to use the same shell for scripting and interactive use.  Many of us like csh(1) for interactive use.  Write your shell scripts in sh(1) (as they should be) and you've got the best of both.


----------



## df (Nov 5, 2012)

If that's right, I'll jump in to the wagon and check out csh.

Cheers!


----------



## UNIXgod (Nov 6, 2012)

df said:
			
		

> If that's right, I'll jump in to the wagon and check out csh.
> 
> Cheers!



Zsh is a nice alternative to bash for a third party bourne compatible shell. I may start playing with csh again soon. Set some completions for when I'm root.

You may want to post your patch to http://www5.us.freebsd.org/send-pr.html

Curious though. Is there an option to compile ash without the new interactive features though make.conf. sh used to be around 90k. Now it's 140k. The little buggers getting kinda unnecessarily fat.


----------



## df (Nov 6, 2012)

UNIXgod said:
			
		

> You may want to post your patch to http://www5.us.freebsd.org/send-pr.html


I couldn't find the issue from GNATS so patch sent, thanks!



			
				UNIXgod said:
			
		

> Curious though. Is there an option to compile ash without the new interactive features though make.conf. sh used to be around 90k. Now it's 140k. The little buggers getting kinda unnecessarily fat.


Hehe, real obese bastard, isn't it?


----------



## AlexJ (Nov 6, 2012)

UNIXgod said:
			
		

> sh used to be around 90k. Now it's 140k. The little buggers getting kinda unnecessarily fat.



It isn't 140k and get just a little fat (3.5kb difference between FreeBSD 7 and 9). 

FreeBSD 7.4-RELEASE
[cmd=""]# ls -laoFG /bin/sh
-r-xr-xr-x  1 root  wheel  - 116584 Jan  1  2012 /bin/sh*
[/cmd]

FreeBSD 8.3-RELEASE
[cmd=""]# ls -laoFG /bin/sh
-r-xr-xr-x  1 root  wheel  - 118512 Apr 22  2012 /bin/sh*
[/cmd]

FreeBSD 9.0-RELEASE
[cmd=""]# ls -laoFG /bin/sh
-r-xr-xr-x  1 root  wheel  - 120056 Jan  3  2012 /bin/sh*
[/cmd]


----------



## UNIXgod (Nov 6, 2012)

AlexJ said:
			
		

> FreeBSD 9.0-RELEASE
> [cmd=""]# ls -laoFG /bin/sh
> -r-xr-xr-x  1 root  wheel  - 120056 Jan  3  2012 /bin/sh*
> [/cmd]



Ha. I betcha used clang. Mine was compiled with gcc. There is something different here:

`%  uname -sr                                       
FreeBSD 9.0-RELEASE`
`%  du -h `which sh`                               
140k	/bin/sh`
`%  ls -laoFG /bin/sh                               
-r-xr-xr-x  1 root  wheel  - 142976 Apr 16  2012 /bin/sh`

It's nice to know the compiler upgrade will also bring in some benefits with world binaries =)


----------

