Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Problems with ls and ll investigated' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Problems with ls and ll investigated
Authored by: hysterion on Feb 08, '02 07:24:32PM

> printf '#! /bin/sh n echo "foo"' > test
> chmod 700 test
> alias test "test dummyarg"
> test
>
> will display foo, rather than test in the titlebar.
> This is the analogue of what the ls alias does right?

I still can't reproduce this one. If I do the exact same thing (again, insert backslash before the n):

[localhost:~] fz% printf '#! /bin/sh \n echo "foo"' > test
[localhost:~] fz% chmod 700 test
[localhost:~] fz% alias test "test dummyarg"
[localhost:~] fz% test

it just sits there (no output, no change in the title bar). If I fix it thus:

[localhost:~] fz% printf '#! /bin/sh \n echo "foo"' > test
[localhost:~] fz% chmod 700 test
[localhost:~] fz% alias test "./test dummyarg"
[localhost:~] fz% test
foo

then the script works but I get "./test dummyarg", not "foo", in the title bar. I tried a few other changes, but none will put "foo" in the title bar.

I see the problem with aliasing ls -<something>, though -- it looks like the title bar catches the first line of output. For example:

[localhost:~] fz% alias ls 'ls -l'
[localhost:~] fz% ls

drwxr-xr-x 22 fz staff 704 Feb 7 06:05 Applications
drwx------ 16 fz staff 500 Feb 7 01:33 Desktop
drwx------ 21 fz staff 670 Feb 8 14:46 Documents
drwx------ 36 fz staff 1180 Jan 31 01:34 Library
drwx------ 3 fz staff 264 Jan 25 02:55 Movies
drwx------ 2 fz staff 264 Dec 10 08:37 Music
drwx------ 3 fz staff 264 Jan 30 06:50 Pictures
drwxr-xr-x 10 fz staff 296 Jan 26 14:18 Projects
drwxr-xr-x 4 fz staff 264 Nov 20 17:51 Public
drwxr-xr-x 5 fz staff 264 Nov 20 17:51 Sites
-rwx------ 1 fz staff 23 Feb 8 19:12 test
-rwx------ 1 fz staff 21 Feb 7 17:29 test1

the title bar says "total 24". The weird thing is, it only seems to happen when the alias itself is named ls. Indeed, compare the above with:


[localhost:~] fz% unalias ls
[localhost:~] fz% alias lt 'ls -l'
[localhost:~] fz% lt
total 24
drwxr-xr-x 22 fz staff 704 Feb 7 06:05 Applications
drwx------ 16 fz staff 500 Feb 7 01:33 Desktop
drwx------ 21 fz staff 670 Feb 8 14:46 Documents
drwx------ 36 fz staff 1180 Jan 31 01:34 Library
drwx------ 3 fz staff 264 Jan 25 02:55 Movies
drwx------ 2 fz staff 264 Dec 10 08:37 Music
drwx------ 3 fz staff 264 Jan 30 06:50 Pictures
drwxr-xr-x 10 fz staff 296 Jan 26 14:18 Projects
drwxr-xr-x 4 fz staff 264 Nov 20 17:51 Public
drwxr-xr-x 5 fz staff 264 Nov 20 17:51 Sites
-rwx------ 1 fz staff 23 Feb 8 19:12 test
-rwx------ 1 fz staff 21 Feb 7 17:29 test1

Can anyone explain this ?!?







[ Reply to This | # ]