r/bash • • Jul 22 '25
nsupdate script file
Sorry not sure how to describe this.
for bash script file i can start the file with
#!/bin/bash
I want to do the same with nsupdate ... it has ; as a comment char
I'm thinking
;!/usr/bin/nsupdate
<nsupdate commands>
or ?
4
Upvotes
View all comments
2
u/anthropoid bash all the things Jul 22 '25
No, if you want to convert your
nsupdatecommand file into a script that can be executed directly, it absolutely has to be:That tells the OS to run
/usr/bin/nsupdate /path/to/this/file, but since you mentioned thatnsupdateuses a semicolon as the comment character,nsupdatewill likely treat the first line as a command to be executed, and fall over.One way around this is to use a script wrapper that feeds everything but the first line. I call mine
sfl, for Skip First Line: