Re: Migrating from tcsh to bash (issues)

2009-02-03 Thread Simos
Thanks Paul, Freddy, Chet.

Regarding printexitvalue, I use

trap '__exit_value_bashrc=$?; if [ $__exit_value_bashrc -ne 0 ]; then
echo "Exit $__exit_value_bashrc"; fi' ERR

so that an exit value is printed when it is other than 0.

I pushed all changes to
http://github.com/simos/bashrc/

Cheers,
Simos

On Tue, Feb 3, 2009 at 8:32 PM, Freddy Vulto  wrote:
> My mistake, the 'trap' of (5) needs to be defined within single quotes
> to prevent the $? from expanding too soon:
>
>   $ trap 'echo Exit $?' ERR
>
> Freddy Vulto
>




Re: Migrating from tcsh to bash (issues)

2009-02-03 Thread Simos
On Tue, Feb 3, 2009 at 9:24 PM, Stephane CHAZELAS
 wrote:
> 2009-02-3, 19:38(+00), Simos:
> [...]
>> I have been using tcsh for a long time and I plan to move to bash.
> [...]
>
> I'd recommend moving to zsh instead. The transition is easier
> from tcsh and this way to won't have to move from bash to zsh
> later on.

I do not know how well zsh is positioned to become default shell in distros.

My goal is towards enhancing the default shell found in mainstream
distributions.
This helps in training new users, and getting bigger adoption of FLOSS
to the masses.
For example, see https://wiki.ubuntu.com/Spec/EnhancedBash
for the spec to change the default shell settings. It's an amazing
usability opportunity and task. And a really difficult one as well.

Cheers,
Simos




Migrating from tcsh to bash (issues)

2009-02-03 Thread Simos
Hi All,

I have been using tcsh for a long time and I plan to move to bash.
I am trying to replicate my config scripts and I have stumbled on the
following issues. My question is whether bash can do these tasks or
whether they can (hopefully) be added as features in a new version.

1. I have aliases for  "../", ".../" and "/",

alias -- ../='cd ..'
alias -- .../='cd ../..'
alias -- /='cd /'

Bash is not happy with these alias names and does not allow to set them.

The rationale for using them is that, for example for "/", it does not
do anything as a command by itself (gives error), so with an alias we
can get it to perform something reasonable.
Is it possible to set these aliases?

2. An issue with PS1 is that there is no \w or \W version that can
expand the ~. My aim is to get to show the full pathname at all times.

The rationale is that when you manage many systems, it's good to be
able to see where you are in the filesystem. You can always hit
quickly "cd" to make sure you are at the home directory, however it's
nice to see the full path (helps to copy+paste as well).

3. Is it possible, when you press first time Tab for completion, to
perform completion and show the remaining possible completions? (like
M-? does)

That is, if we have
somefile.c file.c myfilename1.c myfilename2.c myfilename3.c
and we type
vi my

we get on the first  the output

myfilename1.c myfilename2.c myfilename3.c
vi myfilename_

which we can now type a number to resolve an ambiguity.

4. Does the 'set watch(0 any any)' command in tcsh have an equivalent
in bash; It makes the shell to keep track of /var/log/wtmp, and report
when other users login/logout.
There was a thread in 2000 at
http://www.linux.ie/old-list/17375.html
Is there a built-in command for this now?

5. Is there an option in bash to print the exit value of commands?
For example,
$ wc /tmp/qqwoieuqo
wc: /tmp/qqwoieuqo: No such file or directory
Exit 1<- this
$ _

Cheers,
Simos

p.s.
I have been maintaining tchsrc.sf.net and I plan to move the
functionality to http://github.com/simos/bashrc/




Re: Migrating from tcsh to bash (issues)

2009-02-05 Thread Simos
On Thu, Feb 5, 2009 at 7:12 PM, Matthew Woehlke
 wrote:
> Simos wrote:
>>
>> Regarding printexitvalue, I use
>>
>> trap '__exit_value_bashrc=$?; if [ $__exit_value_bashrc -ne 0 ]; then
>> echo "Exit $__exit_value_bashrc"; fi' ERR
>>
>> so that an exit value is printed when it is other than 0.
>
> That shouldn't be necessary. An exit of 0 is not considered an error, and so
> should not trip an ERR trap. Freddy's example should be sufficient. (WFM
> with 3.2, anyway.)

That's right. I reverted to the version that Freddy gave earlier.

I pushed to
http://github.com/simos/bashrc/

Cheers,
Simos