LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   [SOLVED]Question about script (https://www.linuxquestions.org/questions/linux-general-1/%5Bsolved%5Dquestion-about-script-839837/)

kususe 10-22-2010 03:06 PM

[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!!:hattip:

MensaWater 10-22-2010 03:21 PM

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$')

forrestt 10-22-2010 04:17 PM

You can get the same results w/
Code:

ls *mp3
and then you won't need the grep.

HTH

Forrest

forrestt 10-22-2010 04:27 PM

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

Code:

MP3LIST=*mp3
HTH

Forrest

kususe 10-23-2010 06:19 AM

Ahahahah!!
It was so simple!
Ahhh, a lot of things about linux I have to learn!
ahahah

Thanks to everybody!!


All times are GMT -5. The time now is 02:46 PM.