LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-24-2004, 04:34 AM   #1
hemp4fuel
Member
 
Registered: Jun 2003
Location: Topeka, KS
Distribution: Slackware
Posts: 193

Rep: Reputation: 45
script for a command that won't accept wildcard value


I would like to make a script for a command that won't take wild card values. The command I want to automate is 'shorten -k *.shn' which will append seek tables to .shn files. When I invoke this command now in a directory full of .shn files I get this error: 'shorten: too many filenames' so I have to do it manually for each file. I don't know why it won't accept the wild card value like most commands do, if it did I would just do 'shorten -k *.shn' which is easy enough. Can anyone give me advice on making a script to do this?

Thanks for your time.
 
Old 05-24-2004, 04:37 AM   #2
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
find . -name "*.shn" -exec shorten -k {} \;

watch the spaces
 
1 members found this post helpful.
Old 05-24-2004, 04:44 AM   #3
hemp4fuel
Member
 
Registered: Jun 2003
Location: Topeka, KS
Distribution: Slackware
Posts: 193

Original Poster
Rep: Reputation: 45
Thanks a lot.
 
Old 05-24-2004, 05:07 AM   #4
whansard
Senior Member
 
Registered: Dec 2002
Location: Mosquitoville
Distribution: RH 6.2, Gen2, Knoppix,arch, bodhi, studio, suse, mint
Posts: 3,304

Rep: Reputation: 65
this is the script way to do it.


for a in *.shn ; do
shorten -k "$a"
done
 
1 members found this post helpful.
Old 05-24-2004, 05:30 AM   #5
hemp4fuel
Member
 
Registered: Jun 2003
Location: Topeka, KS
Distribution: Slackware
Posts: 193

Original Poster
Rep: Reputation: 45
I had been fighting with this for awhile and was very close to having what you wrote there but had a few things wrong, thanks again.
 
  


Reply



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
sed doesn't accept $variable in bash script chii-chan Programming 6 05-28-2005 07:07 AM
Script accept unlimited number of options. chii-chan Linux - Newbie 4 06-02-2004 08:54 AM
cat sh script wildcard problem scm Programming 8 04-21-2004 05:19 AM
Hping install will not accept the Make command kwunderlich Linux - Software 0 12-31-2003 11:15 AM
Perl: Getting a script to accept arguments JStew Programming 10 03-10-2003 06:56 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:05 AM.

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