public inbox for dash@vger.kernel.org
 help / color / mirror / Atom feed
From: "Дилян Палаузов" <dilyan.palauzov@aegee.org>
To: dash@vger.kernel.org
Subject: Printing C:\abc in a portable way
Date: Wed, 04 Oct 2023 10:47:10 +0200	[thread overview]
Message-ID: <bc35891262faa710fa1f0dc08233c5fe@aegee.org> (raw)

Hello,

I want to print C:\abc in a portable way.  Or rather, store the value 
C:\abc in a variable.  I have bash 5.2.15-3.fc38 and dash 0.5.12-1.fc38. 
  /bin/sh is a symlink to bash.

In interactive bash

echo "C:\\abc"

prints

C:\abc . The same happens when I store in a file and execute it:

#!/bin/bash
echo "C:\\abc"


#!/bin/bash --posix
echo "C:\\abc"


#!/bin/sh
echo "C:\\abc"

With dash it is different:

#!/bin/dash
echo "C:\\abc"

prints C:bc .  When I replace above a with k, echo "C:\\kbc" prints 
C:\kbc .

When I replace the double quotes with single quotes, echo 'C:\\abc' , 
dash prints C:\abc, but bash (interactive, /bin/sh and bash --posix) 
prints C:\\abc .

All that said I think this is a bug in dash.

The above echos are simplified use case, in reality I want to execute 
A="C:\\abc" ./script and the script shall see C:\abc as value to the 
variable A.

Kind regards
   Dilyan

             reply	other threads:[~2023-10-04  8:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04  8:47 Дилян Палаузов [this message]
2023-10-04 12:28 ` Printing C:\abc in a portable way Harald van Dijk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bc35891262faa710fa1f0dc08233c5fe@aegee.org \
    --to=dilyan.palauzov@aegee.org \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox