bohawk
bohawk

Reputation: 71

Bash error not recognizing asterisk

Hello I am trying to write a Bash Script that will loop through a directory, and run the files in that directory through a command line program.

Unfortunately when I run it I keep getting

/home/user/Documents/Original_Files/*.fastq.gz: No such file or directory

Here's my code

Origin=/home/user/Documents/Original_Files/*.fastq.gz

for a in "$Origin"
do
BASE=basename "$a"
nohup java -jar $
done

Upvotes: 0

Views: 214

Answers (1)

choroba
choroba

Reputation: 241878

Use an array if you want to keep several values in a variable.

Origin=(/home/user/Documents/Original_Files/*.fastq.gz)
for a in "${Origin[@]}" ; do
    BASE=$(basename "$a")
    nohup java -jar "$BASE"...

Upvotes: 2

Related Questions