changing the output of ls to use quotations


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting changing the output of ls to use quotations
# 1  
Old 07-06-2010
changing the output of ls to use quotations

Hi, this is on mac osx. Im using this to find all mp3 files in my downloads folder. I would like to then add these files to itunes

Code:
 ls -R | grep .mp3

I would then do soemthing like

Code:
 for x in `ls -R | grep .mp3`; do open -a itunes 
done

then it says the file /Users/ben/Downloads/anysong.mp3 does not exist. it says this for every mp3 in my downloads folder. I believe if the mp3 file name from ls -R | grep .mp3 were in quotes it would work. So my question is how do i make this happen?

thanks in advance.
# 2  
Old 07-06-2010
Code:
for x in `ls -R | grep .mp3`
do 
   open -a itunes "$x" 
done

# 3  
Old 07-06-2010
hrrm this actually didn't work, gives the exact same error message

---------- Post updated at 02:13 AM ---------- Previous update was at 01:53 AM ----------

Im not sure if this helps but it works if i change .mp3 to .jpeg and change it to open with preview

Last edited by tepinvic; 07-06-2010 at 02:58 AM..
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Output with quotations

I will invoke a shell script.bash -x ./00_remove_tenants_FR_BE_instanceData.sh CGD2ICON CGDEV2 50005 cgdev2@123 I need a string of "cgdev2/'cgdev2@123'@localhost:50005/cgd2icon" parameters ==> 2nd 4th 3rd ... (3 Replies)
Discussion started by: pranabpal
3 Replies

2. Shell Programming and Scripting

awk changing numbering in output file

The below awk is supposed filter $8 of example.txt using the each line in gene.txt. I think it is but why is it renumbering the 1,2,3 in $1 to 28,29,394? I have attached the data as it is large, example.txt is the file to be searched, gene.txt has the lines to match, and filtered.txt is the current... (2 Replies)
Discussion started by: cmccabe
2 Replies

3. Shell Programming and Scripting

Help with nested $s and quotations in bash / awk

Folks - newbie bash coder here and I'd like to get your help to make the code below work. As you can see, I was trying to count the total number of lines with the 3rd value >= 15 in a file and wanted to make the threshold "15" configurable, but apparently the $THRESHOLD value was not populated... (3 Replies)
Discussion started by: bashzipper
3 Replies

4. Shell Programming and Scripting

Using a Regex with double quotations

Hi All, for a script I'm writing I need to be able to put the following command in a variable: tail -30 <file> | egrep "JBoss \(MX MicroKernel\) .* Started" I thought surround it with single quotes would work. However, it doesnt escape the wildcard, and results in the wildcard being expanded... (8 Replies)
Discussion started by: dpatters
8 Replies

5. UNIX for Dummies Questions & Answers

Changing Man page output

I've been asked to come up with a command to display a man page that will continuously scrol (i.e. not hitting space/enter)l. Is there a way do this? I'm stumped. Thank you for your help. (8 Replies)
Discussion started by: Opy99
8 Replies

6. Shell Programming and Scripting

Help changing date output with AWK

Hello all, I have an issue where I'm trying to change a date in a csv text file. The file contains lines that have several fields. For example "John", "Smith","some_address","some_city","555-555-5555","11/11/1972" "Joan","User","some_address","some_city","444-444-4444","12/02/1963" The date... (6 Replies)
Discussion started by: commobox
6 Replies

7. UNIX for Dummies Questions & Answers

send output of a file as input for changing date

Hi, Please help me out on this one. I want to send the output of a file as input for changing the date using date command. Example, i have a file date.txt whose contents are 081014462009 I need to use the date in that file as input for date command. I tried cat date.txt | date ; but it... (2 Replies)
Discussion started by: foxtron
2 Replies

8. UNIX for Advanced & Expert Users

Changing the appearance of an Output in console

I want to change the appearance of a message I got in UNIX console. Eg: In console: "no server running" I need it as "****no server running*****". Thanks in advance. (3 Replies)
Discussion started by: thomaa80
3 Replies

9. Shell Programming and Scripting

Changing the output in own time display's.

Hi all, I've written a script which collects some information and sendsout a mail.. (code pasted below) ssh -l ora${sid} ${primaryhost} "tail -50 /oracle/$ORACLE_SID/newbackup/END_BACKUP.log" |grep 'insert' |tail -1| awk '{print $7}' >> ${RESULTFILE} Output would look like this:... (1 Reply)
Discussion started by: suri.tyson
1 Replies

10. UNIX for Dummies Questions & Answers

Changing persmissions for output file in UNIX box with SQR.

I am trying to change permissions on an output file from an sqr. The file is pushed out into a directory on the unix box. I am using the following code in the sqr to accomplish this. if $OUTPUT <> '' let $unix_call = 'chmod 664 '||$OUTPUT show $unix_call CALL SYSTEM Using... (1 Reply)
Discussion started by: evengetsteven
1 Replies
Login or Register to Ask a Question