LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux shell command questions (https://www.linuxquestions.org/questions/linux-newbie-8/linux-shell-command-questions-252901/)

BabaKali 11-09-2004 02:13 PM

Linux shell command questions
 
Hi all,



1. how can I rename multiple files to SUBTRACT characters from the original name, rather than add, kinda the opposite of what you do with for file.....done command, like:

for file in *.old;
do
mv -v $file ---here I want to rename the file from barbie.txt.old back to barbie.txt
done



2. how can I delete shell variable?

3. in OPENNA when Ctrl+D nothing happens

4. will !ch insert most recent command that started with ch? like if I had chmod 770, will !ch insert chmod 770?


Thanks in advance

ror 11-09-2004 02:29 PM

I'd use sed s/old.txt/txt (dunno if you need a \ before the . ?) but then I take long winded ways of doing things.

BabaKali 11-09-2004 02:56 PM

thanks, do you mean

for file in *.old;
do
sed s/old.txt/txt
done


That didn't do it

LasseW 11-09-2004 03:29 PM

1. Try this command

for F in *.old
do
mv -v "$F" ${F%.old}
done

2. unset <variable>

BabaKali 11-09-2004 08:03 PM

thanks, I'll give it a shot


All times are GMT -5. The time now is 07:48 PM.