LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-09-2004, 02:13 PM   #1
BabaKali
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Rep: Reputation: 0
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
 
Old 11-09-2004, 02:29 PM   #2
ror
Member
 
Registered: May 2004
Distribution: Ubuntu
Posts: 583

Rep: Reputation: 33
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.
 
Old 11-09-2004, 02:56 PM   #3
BabaKali
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
thanks, do you mean

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


That didn't do it
 
Old 11-09-2004, 03:29 PM   #4
LasseW
Member
 
Registered: Oct 2004
Distribution: Fedora 7, OpenSuse 10.2
Posts: 108

Rep: Reputation: 15
1. Try this command

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

2. unset <variable>
 
Old 11-09-2004, 08:03 PM   #5
BabaKali
LQ Newbie
 
Registered: Nov 2004
Posts: 9

Original Poster
Rep: Reputation: 0
thanks, I'll give it a shot
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shell command to shutdown linux OS alix123 Programming 3 08-22-2005 08:17 AM
Linux Command and...Questions chipnuke Linux - Software 1 12-28-2004 10:09 AM
How to call the arp linux shell command from within a perl program Bassam Programming 1 03-11-2004 02:00 AM
Two Linux shell scripting questions thepryme Programming 5 10-23-2003 07:01 AM
make a windows host dial-up isp from a linux shell command? Phantomas Linux - Networking 3 08-23-2003 07:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:02 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration