Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8548953
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:36:58+00:00 2026-06-11T13:36:58+00:00

The awk manual lists this as one of the first examples: awk BEGIN {

  • 0

The awk manual lists this as one of the first examples:

awk "BEGIN { print \"Don't Panic!\" }"

Apparently I should see “Don’t Panic!”, but actually I see:

-bash: !\": event not found

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:36:59+00:00Added an answer on June 11, 2026 at 1:36 pm

    It all depends on your shell.

    > bash
    $ awk "BEGIN { print \"Don't Panic!\" }"
    bash: !\": event not found
    $ tcsh
    > awk "BEGIN { print \"Don't Panic!\" }"
    Unmatched '.
    > sh
    $ awk "BEGIN { print \"Don't Panic!\" }"
    Don't Panic!
    $ 
    

    Exclamation points are used by modern shells to refer to parts of your command line history. In bash and tcsh, they can be interpreted as a history reference. You can escape the ! with a \, or you can leave it out, or you can use a simple shell.

    In my bash example above, you see thie failed history substitution. In my tcsh example, you see a problem with quoting (since double quotes can’t be escaped this way). The awk manual you’re using is presumably old enough that it doesn’t assume everyone runs bash.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

awk supports this: awk '{print $(NF-1);}' but not for user-defined variables: awk '{a=123; b=a;
awk newbie here.. I'm trying this: top -b -p 30259 | awk 'BEGIN {
I have this awk script: #!/usr/bin/awk -f BEGIN {IGNORECASE=1} /nVidia/ {inner=1;pci=$1} /(corr|fatal)err\-/ {if (inner)
Using awk I have written this script but it's not working properly. Even I
Why this awk script: awk '{FS = \t ; print $1 - $2}' A.txt
I have this command: awk 'BEGIN {system (mplayer mms :// xx.xx.xx -dumpstream -dumpfile xxx.wmv)}'
echo bla | awk 'BEGIN{fname=foo.txt} {print $0 >>fname; print rm -f fname | /usr/bin/ksh;
How would an awk script (presumably a one-liner) for removing a BOM look like?
I have an awk script that I have defined thus: #!/usr/bin/env awk BEGIN {
Looking for an awk (or sed) one-liner to remove lines from the output if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.