LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 01-24-2010, 06:59 AM   #1
NothingToLose
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Rep: Reputation: 0
Bash: How I send clipboard to festival or what is wrong here?


How I send clipboard to festival or what is wrong here?

#!/bin/bash

text='xclip -selection clipboard -o'
echo '(voice_nitech_us_awb_arctic_hts) (SayText "$text")' | festival

Says only "dollar text" to me.

Just this works, but I want other script with different voice:
#!/bin/bash

xclip -selection clipboard -o | festival --tts

Voice changed here:
echo '(voice_nitech_us_awb_arctic_hts) (SayText "say this please")' | festival
 
Old 01-24-2010, 07:04 AM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Try
Code:
text=`xclip -selection clipboard -o`
Those are back quotes instead of straight quotes.

Actually it's better to use
Code:
text=$(xclip -selection clipboard -o)
for reasons explained here, including the one you know about -- that back quotes are easily mistaken for straight quotes!
 
Old 01-24-2010, 07:24 AM   #3
NothingToLose
LQ Newbie
 
Registered: Jan 2010
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks! I also found that I have to use:

echo "(voice_nitech_us_awb_arctic_hts) (SayText \"$text\")" | festival

Double quotes and \ for escape.
 
Old 01-24-2010, 07:42 AM   #4
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by NothingToLose View Post
Thanks! I also found that I have to use:

echo "(voice_nitech_us_awb_arctic_hts) (SayText \"$text\")" | festival

Double quotes and \ for escape.
That makes some sense because the value of $text would not be substituted if it appears between single quotes. Presumably festival needs to see the double quotes either side of the value of $text when it reads from stdin.
 
  


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
send mail via bash nima0102 Linux - Newbie 2 07-13-2009 01:19 AM
BASH:Howto let festival read the subjects of the new gmail incoming emails every30min frenchn00b Linux - General 1 03-16-2008 05:39 AM
How to send email using bash? mesh2005 Programming 4 03-03-2007 09:48 AM
bash script to clipboard MikeyCarter Programming 1 05-11-2005 10:49 AM
Wrong info in the emails I send out leecming Linux - Newbie 3 07-04-2004 01:25 PM

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

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