Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • great, could you please elaborate the reasons. Commented Oct 31, 2018 at 13:24
  • 3
    An alternative would be atq | awk "{print \$1}" - sometimes there are reasons you want the double quote, and in that case, escaping the $ is necessary. Contrived example: prefix="foo: "; atq | awk "{print $prefix, \$1}". Granted, that would normally be better accomplished using awks -v variable=... syntax, but it can still be useful sometimes... Commented Oct 31, 2018 at 14:09
  • @twalberg No, you don't generally want the shell to interpolate the awk code. To use a shell variable in an awk program, import it using -v var="$var" or export it and access it through ENVIRON["var"]. Using single quotes around awk code is always possible and always what you'd want to do. Commented Nov 6, 2018 at 10:46