b9AcE #NoEdits on Nostr: OK, gee, that's nice but what if you're sure that you're unsure of the thing that ...
OK, gee, that's nice but what if you're sure that you're unsure of the thing that you're about to put in your UNIX(/Linux) command-line shell script, so you don't wanna just run it to find out you just accidentally your entire computer?
Ah, then you can just tell your computer to "echo" to you what it would think you meant.
Let's say you have a command for example "rm -rf $DELETEME/" and that seems like it's very dangerous because "rm" ("remove") with "recursively" and "force" would remove all the files you can remove (potentially every file on the system) if it's incorrect,
well, then just add the command "echo" first, so it becomes "echo rm -rf $DELETEME/" and run that,
which will then print out what it thought the entire command including the variable "$DELETEME" would have meant if you ran it "live".
Again, maybe not the best example, but I think you see the point... Just add "echo" before any uncertain command to see what it would actually run, including expanding variables, etc.
Works both inside script-files and directly on the command-line of course.
Published at
2023-05-03 21:10:01Event JSON
{
"id": "81fb8f5789b7cfb01f236e50c7c56aaa22d7134d0da44dbcce74e2762b720a25",
"pubkey": "adc8fe765f1ee1b5d721a64dee9006277bb03c60824e45d6f5c0f7897485fd4d",
"created_at": 1683148201,
"kind": 1,
"tags": [
[
"e",
"b6e7f489884ff20ce5c2e513afc3ab7ab3386498ed9642e7ae10eee425ba675b",
"wss://relay.mostr.pub",
"reply"
],
[
"mostr",
"https://todon.eu/users/b9AcE/statuses/110306800534459049"
]
],
"content": "OK, gee, that's nice but what if you're sure that you're unsure of the thing that you're about to put in your UNIX(/Linux) command-line shell script, so you don't wanna just run it to find out you just accidentally your entire computer?\n\nAh, then you can just tell your computer to \"echo\" to you what it would think you meant.\n\nLet's say you have a command for example \"rm -rf $DELETEME/\" and that seems like it's very dangerous because \"rm\" (\"remove\") with \"recursively\" and \"force\" would remove all the files you can remove (potentially every file on the system) if it's incorrect,\nwell, then just add the command \"echo\" first, so it becomes \"echo rm -rf $DELETEME/\" and run that,\nwhich will then print out what it thought the entire command including the variable \"$DELETEME\" would have meant if you ran it \"live\".\n\nAgain, maybe not the best example, but I think you see the point... Just add \"echo\" before any uncertain command to see what it would actually run, including expanding variables, etc.\nWorks both inside script-files and directly on the command-line of course.",
"sig": "448a522b2d6d4afb9c8ea0e1ccfbf7c727d22c2c3f68f468ab682fab53a1a2ed2f21b1c9f63692df60cbcbc4cea562d0b59b730d10314aa25be912d969d4ec5a"
}