LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-22-2003, 06:56 PM   #1
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Rep: Reputation: 15
scripting help


Is there a good bash scripting tutorial anywhere? I'm trying to write a script that will figure out if the parameter I passed to it ends in .gz .tar or something else, but first I need to convert the string to lowercase... AND NOBODY KNOWS HOW!!!!!!

I've been searching for an hour now and nobody seems to know how to do this stupid little thing!!!! Every time I type

$myvar=${$myWord//'A'/'a'}

I get the error: "bad substitution"


bad substitution MY F****** A** !!!!!!!!!!!!!!!!!!!!!!!!!!

I WISH I COULD JUST WRITE C++ CODE AND USE IT AS SCRIPT!!!!!!!!!
 
Old 11-22-2003, 07:01 PM   #2
DirtDart
Member
 
Registered: Nov 2003
Distribution: Mandrake 10.1/Solaris 10 (sparc)
Posts: 96

Rep: Reputation: 16
$myvar=${echo $myWord | tr '[A-Z]' '[a-z]'}
 
Old 11-22-2003, 07:02 PM   #3
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Original Poster
Rep: Reputation: 15
St. Anger round my neck
St. Anger round my neck
He never gets respect
St. Anger round my neck

St. ANGER round my neck
He never gets RESPECT
ST. ANGER ROUND MY NECK
HE NEVER GETS RESPECT

F*** it all and no regrets
I hit the lights on these dark sets
Medallion noose
St. ANGER round my neck

I Feel my world shake
Like and earthquake
Hard to see clear
Is it me? Is it fear?

I'M MADLY IN ANGER WITH BASH
I'M MADLY IN ANGER WITH BASH
I'M MADLY IN ANGER WITH BASH
I'M MADLY IN ANGER WITH BASH


In other words... I GOT THE SAME ERROR!!!!!!!! ARGGGGGGGGGGGG!!!!!

Last edited by versaulis; 11-22-2003 at 07:03 PM.
 
Old 11-22-2003, 07:02 PM   #4
Skyline
Senior Member
 
Registered: Jun 2003
Distribution: Debian/other
Posts: 2,104

Rep: Reputation: 45
This might come in handy?

http://www.tldp.org/LDP/abs/html/
 
Old 11-22-2003, 07:04 PM   #5
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Original Poster
Rep: Reputation: 15
I've been string at that webpage for a while now... not helping
 
Old 11-22-2003, 07:07 PM   #6
teval
Member
 
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Gentoo
Posts: 720

Rep: Reputation: 30
$myvar = `echo $myWord | tr [:upper:] [:lower:]`
 
Old 11-22-2003, 07:10 PM   #7
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Original Poster
Rep: Reputation: 15
#!/bin/bash

if [ $# -eq 0 ]
then
echo "Required parameter not provided."
else
fFile=$1

$fFile = `echo $fFile | tr [:upper:] [:lower:]`
echo $fFile
fi


then i type in:
lowercase FWAA

and get error:
/usr/bin/lowercase: line 9: FWAA: command not found

Last edited by versaulis; 11-22-2003 at 07:14 PM.
 
Old 11-22-2003, 07:49 PM   #8
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Original Poster
Rep: Reputation: 15
echo $fFile | tr [:upper:] [:lower:]

gives me the lowercase, but

$fFile = 'echo $fFile | tr [:upper:] [:lower:]'

gives me

/usr/bin/lowercase: line 8: FWAA: command not found
FWAA
 
Old 11-22-2003, 08:08 PM   #9
versaulis
Member
 
Registered: Sep 2003
Posts: 139

Original Poster
Rep: Reputation: 15
NOT FAIR!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

For anyone reading this well after I've had this problem and thrown a cursing fit... the entire problem is that I was using ' instead of `

Make sure you use the character that is below the ~ on your keyboard!!
 
  


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
new to scripting mifan Linux - Newbie 2 08-17-2005 01:10 PM
another help with scripting?! ice99 Programming 2 08-09-2005 09:56 AM
Need help scripting Tamara Programming 7 06-06-2005 03:06 AM
Scripting Help Please Jazinator Linux - Newbie 7 10-17-2004 07:35 PM
scripting bforest Linux - Newbie 4 05-11-2004 03:45 AM


All times are GMT -5. The time now is 02:58 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration