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 8605743
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:54:51+00:00 2026-06-12T02:54:51+00:00

I get this behavior when using Bash (under Cygwin): $ printf ‘\u00d5’ \u00d5 $

  • 0

I get this behavior when using Bash (under Cygwin):

$ printf '\u00d5'
\u00d5
$ env printf '\u00d5' # This results in the behavior I want
Õ

It does not matter if I use UTF-8 or ISO-8859-1 encoding in the terminal.

My questions are: Exactly what does env do? Why do I need it in this specific case?

  • 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-12T02:54:52+00:00Added an answer on June 12, 2026 at 2:54 am

    env is not in bash, it’s a standalone executable, it is used to set or clear environment variable before running program. In your particular case, it’s running the binary printf instead of the shell builtin. You can achieve the same result by using the absolute path:

    /usr/bin/printf '\u00d5'
    

    The least intrusive method is perhaps the following: redefine the printf function and have Bash handle the rest. Source a file that contains the following:

    function printf()
    {
      $(which printf) "$@"
    }
    

    or as a one-liner function printf() { $(which printf) "$@"; }. Of course you could replace the $(which printf) for a /usr/bin/printf …

    Then simply use printf as you’re used to. Your script stays the same and you could even introduce a condition to define the function only on certain Bash versions.

    AFAIK you can also leave out the function, but I find it adds to readability.

    [EDIT: the function keyword is a bash extension; printf () { ...; } is the POSIX syntax. If you do use the function keyword, the () after the function name are optional.]


    Commonly, env is also used in the hash-bang lines of scripts that strive to be portable. The reason being that env is nearly always at /usr/bin/env, while bash isn’t always at /bin/bash as many a hash-bang line implies. Example:

    #!/usr/bin/env bash
    

    also works for other programs/interpreters:

    #!/usr/bin/env python
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get this behavior in both Chrome (Developer Tools) and Firefox (Firebug). Note the
Real noob question no doubt, but I can't get my head around this behaviour.
Mainly this is a question about how to get a similar behaviour as java
I get this error while accessing a php script: W/System.err: Error reading from ./org/apache/harmony/awt/www/content/text/html.class
I get this error when i try to upload an image: OSError at /upload/
I get this error on my Ice Cream Sandwich (Android 4.0) device and emulator.
Cant get this script to work with my menu really have tried everything any
I get this error when I run the code below. I have normally used
I get this error when I use simplejson from django.utils in google app engine
I get this RSpec error when I try to embed one document in another.

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.