bash suffix removal

Chuck Adams k7qo at commspeed.net
Fri Jan 25 22:56:07 UTC 2008


This group is so sharp I thought I'd ask here as
my search hasn't come up with an answer.

Since, after 30+ years of using the C-shell
and giving up my fight to convert the masses,
I have been trying to learn the bash shell,
I need the following.

In the C-shell if you have a variable $i,
the syntax

$i:r

removes the suffix.  Thus if $i is file.jpg,
the $i:r is file and you can write
$i:r.ps  to get file.ps

I use loops to do a number of files, thus

for i in *.jpg
do
jpeg2ps $i > $i:r.ps
done

is the desired sequence, but $:r.ps
isn't the correct syntax in bash.

Help.  Simple syntax available?
Hate to be ignorant.

ciao,

Chuck

I knew you could do it.

-- 
Chuck Adams, K7QO
k7qo at commspeed.net
http://www.k7qo.net/

Moving to Arizona?  Bring your own water, please.





More information about the kubuntu-users mailing list