I am tired of creating a file with nano, saving it and then making it executable. Is there a command that makes it in one step?

  • kayaven@lemmy.world
    link
    fedilink
    arrow-up
    13
    ·
    6 months ago

    You could define a function that takes a parameter, which touches a file with the parameters value, chmods it and then opens it with nano?

    create_exec() {
        touch "$1"
        chmod +x "$1"
        nano "$1"
    }
    

    Then you could type create_exec file.sh and it would do the rest for you.