Home > Net >  permission denied on .gz files on linux
permission denied on .gz files on linux

Time:12-02

I have some .gz files, of which i want to run a script on. I need these files to remain in .gz format. When I run my script:

#!#bin#bash
for f1 in $(~/Desktop/hawkfiles17/NG*.fq.gz);
do
  echo "${f1}"
done

I want to check the location of the files. The script returns:

bash: /home/amyhouseman/Desktop/hawkfiles1/NG0921017_EKDN210018957-1A_HN2MGDSX2_L2_1.fq.gz: Permission denied`

I have tried using: chmod u x /home/amyhouseman/Desktop/hawkfiles17/NG0921017_EKDN210018957-1A_HN2MGDSX2_L2_1.fq.gz, but bash returns:

bash: /home/amyhouseman/Desktop/hawkfiles17/NG0921017_EKDN210018957-1A_HN2MGDSX2_L2_1.fq.gz: cannot execute binary file: Exec format error

I'd be grateful if someone could help, I know that you can't execute .gz files, but I'm not sure what else i can do? I did look through other posts before.

CodePudding user response:

I want to check the location of the files.

You're shebang is incorrect, and several other small strings.

Here is your solution:

$ cat my_script.sh
#!/bin/bash
for item in $(ls ~/Desktop/hawkfiles17/NG*.fq.gz) ; do echo "$item" ; done
  • Related