Re: [PATCH] [TCK] Convert scripts to also run with dash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16/11/2010, at 6:08 AM, Stefan Berger wrote:
<snip>
>> Ah - the plot thickens, and the light bulb goes on for me.  It's not
>> just a problem with read, but also with your use of 'echo' to try and
>> replay a just-read string.  'echo' and '\' don't mix.  You have to use
>> printf for any chance of portability.
>> 
>> printf %s\\n "\1"
>> printf %s\\n '\1'
> I am surprised that dash doesn't take the opportunity to already extend "\1" or '\1' to char(1) in these cases.  A mystery... :-)
> 
> I'll fix it. Thanks.

We seem to have recurring problems with finding portable commands, that work across everything.

Would use an alternative approach, such as having our own wrapper functions, be more reliable?

(conceptually like this)

function replace_stuff()
{
  if "$SHELL" = "dash"
    dash specific sed here
  elsif "$SHELL = bash"
    bash specific sed here
  else
    sh fallback sed here
  fi
}

# main code
replace_stuff ("foo" "bar")

?

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]