shell script: bad interpreter: No such file or directory when using pwd

后端 未结 11 1639
抹茶落季
抹茶落季 2021-02-07 09:30

I want to go through the files in a directory with a for loop but this comes up.

echo: bad interpreter: No such file or directory

code:

11条回答
  •  既然无缘
    2021-02-07 10:04

    so, if you change your username group priority from username to root, you should change

    #!/user/bin/bash
    

    to

    #!/bin/bash
    

    check your user group (my username is rommi)

    $ groups rommi
    

    this command will output:

    rommi : root adm cdrom sudo dip plugdev lxd lpadmin sambashare
    

    since my username group priority is set to root, i should change my script to

    #!/bin/bash
    

    i change the priority group using:

    sudo usermod -g root rommi
    

    if groups rommi command outputs:

    rommi : rommi adm cdrom sudo dip plugdev lxd lpadmin sambashare
    

    then my script should use #!/usr/bin/bash

    fail make this changes will resutl in bad interpreter: No such file or directory error

提交回复
热议问题