[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cobalt-users] OT: to you script-heros...
- Subject: Re: [cobalt-users] OT: to you script-heros...
- From: cobalt@xxxxxxxxxxxx (Peter Fokker)
- Date: Wed Mar 31 13:25:01 2004
- List-id: Mailing list for users to share thoughts on Sun Cobalt products. <cobalt-users.list.cobalt.com>
"> freitag lab. ag / nafroth" wrote:
> hoi,
>
> i know that here are some good sript writers... i got a small problem and i
> think, it is 5 mins for one...
>
> maybe someone can give me a hint:
>
> i need a shell script with syntax script /path/to/folder which prints the
> content (in may case pictures.jpg) on screen or piped in a file like 1.jpg,
> 2.jpg, 3.jpg (seperated by ",").
>
> to say in words: ls on a folder, remove every info except filename.ext and
> print it...
>
> any ideas?
Many come to mind... ;-)
How about this (not quite tested) script?
#!/bin/bash
OLDDIR=`pwd`
TARGET="$1"
cd $TARGET
comma="" ; for f in *; do echo -n "$comma$f"; comma=","; done
cd $OLDDIR
Good luck,
--Peter Fokker
--
The continued spread of a cleverly engineered computer virus exposes a
key flaw in the global embrace of technology: Its users are human.
--Anick Jesdanun, AP Internet Writer, 27 January 2004