LinuxQuestions.org
Help answer threads with 0 replies.
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 09-04-2006, 01:23 PM   #1
alieas
LQ Newbie
 
Registered: Sep 2006
Posts: 7

Rep: Reputation: 0
Bash Concatenation


Learning a little bit about bash scripting:

I would like to concatenate a file name while using "tiff2pdf". The original filename is $FILE.

tiff2pdf $FILE -o $FILE+".pdf"


I am looking for the correct syntax to attach the ".pdf" extension to the filename. It would be even better if it could remove the .TIF and replace it with .PDF, can anyone give me the correct syntax for this operation?

Thank you,

-Joe
 
Old 09-04-2006, 01:40 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

$FILE.pdf
or
$FILE".pdf"
or
${FILE}.pdf

All of them work, and there are more

Hope this helps.
 
Old 09-04-2006, 01:42 PM   #3
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
You can use someting like
Code:
FILE="something.tif"; echo "${FILE%.tif}.pdf"
 
Old 09-04-2006, 01:45 PM   #4
alieas
LQ Newbie
 
Registered: Sep 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Excellent, thanks alot guys. I'll have to guy buy a bash scriping book
 
  


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
any command line software for ogg concatenation but ogmcat.? Joining ogg files Emmanuel_uk Linux - Software 1 06-15-2006 09:52 AM
Postgresql aggregate text functions - concatenation, merge rjlee Programming 0 07-13-2005 04:10 PM
PERL: concatenation of variables issue randomx Programming 2 01-16-2005 04:52 PM
why did bash 2.05b install delete /bin/bash & "/bin/sh -> bash"? johnpipe Linux - Software 2 06-06-2004 06:42 PM
string concatenation in AWK xanthium Programming 1 04-22-2002 04:41 AM

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

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