Giving wrong output with sh but correct output with command entry in Ubuntu
Hi there,
I want to execute the command as below using sh: printf '"NA" [slash]"\\t"[modulus].0s' {1..4} PS: Sorry I have to put a "modulus" and "slash" up there because the symbols are missing in the message. which will give output as below that I want: "NA" "\t""NA" "\t""NA" "\t""NA" "\t" I could execute the file using sh in Fedora. However, when I run sh in Ubuntu, it shows the incorrect output below: "NA" [slash]"\t[slash]" When I execute the command, it could give exactly what I want. This happens in Ubuntu but not in Fedora. Anyone has any idea how to fix this? Thanks in advance. |
I think on Ubuntu sh is symlinked (or replaced ?) with dash.
On my Centos, which should probably be the same as Fedora, both 'sh' and 'bash' work, although I did have to add one more '\' Code:
printf "\"NA\" \"\\\t\"%.0s" {1..4} |
Hi Chris,
Appreciate your help. It works with bash but not with sh or dash. I wrote the script in Fedora and this is the first time I execute it in Ubuntu. :) Rgds, Louis |
Hi Louis,
Can you confirm this by running the command below. What is the output? ls -la /bin/sh |
All times are GMT -5. The time now is 07:46 PM. |