Hacker News new | past | comments | ask | show | jobs | submit login

There is no portable way to echo without a newline. Use printf instead.



Meanwhile over in a Makefile...

    # Automatically figure out what echo options to use so that echo
    # '\r\n' actually just outputs the characters CR and LF and nothing
    # else. This is very shell dependent.

    ECHO_OPTIONS := -e -n -en
    ECHO :=
    $(foreach o,$(ECHO_OPTIONS),$(if $(call seq,$(shell echo $o '\r\n' | wc -
    c),2),$(eval ECHO := echo $o)))
    ifeq ($(ECHO),)
    $(error Failed to set ECHO, unable to determine correct echo command, 
    tried options $(ECHO_OPTIONS))
    endif




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: