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

  • Home
  • SEARCH
  • 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 7551093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T10:23:25+00:00 2026-05-30T10:23:25+00:00

I created a bash script to thumbnail all images in a tree. It is

  • 0

I created a bash script to thumbnail all images in a tree. It is the following:

#!/bin/bash

find -path "thumbnails/" -prune -or -iname "*.jpg" -exec \
    bash -c 'convert "$0" -resize 256x256 thumbnails/`sha512sum "$0" | awk "{ print \\$1 }"`.jpg' {} \;
#                                                                                   ^^

In the awk command, there is a double \\. (I’ve marked it with ^^ on the commented line, but you’ll probably need to scroll →) Why do I need two backslashes here? I need one to prevent the shell from attempting to expand $1, but otherwise, we are working within just a single set of single-quotes, which shouldn’t be messing with the number of slashes. Yet, with just one backslash, awk { print  } gets executed, which isn’t correct.

Why the \\?

  • 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-05-30T10:23:27+00:00Added an answer on May 30, 2026 at 10:23 am

    Why do I need two backslashes here? I need one to prevent the shell from attempting to expand $1, but otherwise, we are working within just a single set of single-quotes, which shouldn’t be messing with the number of slashes.

    There are actually two shells here which do all the usual variable/path substitions/expansions, one is

    bash -c
    

    the other is the backtick operator:

    `command`
    

    You need another backlash to prevent expanding of $1.

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

Sidebar

Related Questions

In answering another question I created the following script bash script: #!/bin/bash files1=( file1.txt
the following script.bin append by tee lines to file.log (from my bash script) IP=xxx.xxx.xxx.xxx
I recently created my first bash script, and I am having problems perfecting it's
I've created a few autorun script files on various USB devices that run bash
i have this problem: I have created a bash script that performs some tasks.
I have created a simple bash script, chmod +x, and successfully am running it
with a previous bash script I created a list of files: data_1_box data_2_box ...
I've created a small Bash script that does a MySQL data dump. Because the
I have created a bash script and it runs in the background. It has
I've created a really simple bash script that runs a few commands. one of

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.