supremum supremum - 2 months ago 23
Bash Question

Shell script input directory

I am trying to make enqueue a directory in audacious. For that I want to make a shell script which will take the input I am giving as the directory to enqueue.

find . -iname \*.mp3 -print0 | xargs --null audacious --enqueue
this will enqueue all the files in the current directory. I want to make a shell script which takes the input for current directory.

Answer

Assuming that when you say "input" you're referring to command-line arguments:

#!/bin/sh
exec find "$@" -iname '*.mp3' -exec audacious --enqueue '{}' +