stdenv: change 'echo -n' to 'printf "%s"'

[Bjørn: rationale is portability, "echo -n" isn't in POSIX]

authored by

Nikolay Amiantov and committed by
Bjørn Forsman
ca3ecb56 2ec47049

+3 -4
+3 -4
pkgs/stdenv/generic/setup.sh
··· 101 101 if [ -n "$succeedOnFailure" ]; then 102 102 echo "build failed with exit code $exitCode (ignored)" 103 103 mkdir -p "$out/nix-support" 104 - echo -n $exitCode > "$out/nix-support/failed" 104 + printf "%s" $exitCode > "$out/nix-support/failed" 105 105 exit 0 106 106 fi 107 107 ··· 339 339 local n p pattern replacement varName content 340 340 341 341 # a slightly hacky way to keep newline at the end 342 - content="$(cat "$input"; echo -n X)" 342 + content="$(cat "$input"; printf "%s" X)" 343 343 content="${content%X}" 344 344 345 345 for ((n = 2; n < ${#params[*]}; n += 1)); do ··· 367 367 content="${content//"$pattern"/$replacement}" 368 368 done 369 369 370 - # !!! This doesn't work properly if $content is "-n". 371 - echo -n "$content" > "$output".tmp 370 + printf "%s" "$content" > "$output".tmp 372 371 if [ -x "$output" ]; then chmod +x "$output".tmp; fi 373 372 mv -f "$output".tmp "$output" 374 373 }