LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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, 05: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, 06: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, 06: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 06:03 PM.
 
Old 11-22-2003, 06: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, 06: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, 06: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, 06: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 06:14 PM.
 
Old 11-22-2003, 06: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, 07: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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:37 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