public inbox for dash@vger.kernel.org
 help / color / mirror / Atom feed
* Printing C:\abc in a portable way
@ 2023-10-04  8:47 Дилян Палаузов
  2023-10-04 12:28 ` Harald van Dijk
  0 siblings, 1 reply; 2+ messages in thread
From: Дилян Палаузов @ 2023-10-04  8:47 UTC (permalink / raw)
  To: dash

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-04 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-04  8:47 Printing C:\abc in a portable way Дилян Палаузов
2023-10-04 12:28 ` Harald van Dijk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox