Skip to content

DX Suggestions and ... questions. #11

@airtonix

Description

@airtonix

One

number one on my wtf list is this:

#!/bin/sh
':' //; exec "$(command -v nodejs || command -v node)" "$0" "$@"

console.log('Hello world');

I understand this part: $(command -v nodejs || command -v node)" "$0" "$@"

  • if there's a command on called nodejs, or node, then
  • execute the current file "$0" with whatever args were passed originally "$@"

but the part I'm not entirely understanding is ':' //; :

  • ':' i get that this is just a string so bash does nothing with it?
  • // ; ???? lmao wut?

Second

this lead me to be think about the experience editing this file:

  • because it ends in .sh, or
  • because there's no vim modelines,

There's no automatic correct syntax highlighting (whole file is considered bash so shellcheck screams about everything)

So the second question is did you try this instead:

  • rename the file to rofi-search.js (now the file gets automatic syntax highlighting regardless of the editor)
  • change the hashbang to #!/usr/bin/env node (now the js file will execute with nodejs)

image


My only assumption is that you're trying to account for ubuntu users that incorrectly have nodejs installed via apt as nodejs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions