LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-22-2010, 03:06 PM   #1
kususe
Member
 
Registered: Oct 2010
Posts: 54

Rep: Reputation: 0
[SOLVED]Question about script


I want to write a shell script contains python one.
So,the result of python one is flv file.
I want the path of this is copied into a enviroment variable that i have to pass as a flag argument of another program (to convert into mp3).

To individuate the result of python script I thought to use (in PWD)

Code:
ls | grep -E '^.*mp3$'
But my question is: How can I copy this result into enviroment variable?

I hope to b clear.
Thanks!!

Last edited by kususe; 10-23-2010 at 06:20 AM.
 
Old 10-22-2010, 03:21 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Code:
VAR=$(ls | grep -E '^.*mp3$')
Where VAR is the name of the variable you want to set e.g.

Code:
MP3LIST=$(ls | grep -E '^.*mp3$')
 
Old 10-22-2010, 04:17 PM   #3
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
You can get the same results w/
Code:
ls *mp3
and then you won't need the grep.

HTH

Forrest
 
Old 10-22-2010, 04:27 PM   #4
forrestt
Senior Member
 
Registered: Mar 2004
Location: Cary, NC, USA
Distribution: Fedora, Kubuntu, RedHat, CentOS, SuSe
Posts: 1,288

Rep: Reputation: 99
Actually, you don't even need the ls. Just:

Code:
MP3LIST=*mp3
HTH

Forrest
 
Old 10-23-2010, 06:19 AM   #5
kususe
Member
 
Registered: Oct 2010
Posts: 54

Original Poster
Rep: Reputation: 0
Ahahahah!!
It was so simple!
Ahhh, a lot of things about linux I have to learn!
ahahah

Thanks to everybody!!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Script question tazer92 Programming 6 06-18-2009 04:59 PM
One last script question kinetik Linux - General 2 04-02-2006 05:47 PM
script question therealbxp Programming 5 08-07-2005 04:28 AM
Question on this script. Echo Kilo Programming 2 12-13-2004 04:20 AM
Script Question blubbfish Linux - Newbie 2 04-26-2004 04:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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