bash - No space between *gettext* string and cursor of *read* command -


say following bash script:

#!/bin/bash  export textdomaindir=./locale export textdomain=test-gettext-read . gettext.sh  echo -n $(gettext "insert word: ") read word 

gnu gettext used make string translatable , read used user input. however, if there's trailing space in gettext message, there's no space in terminal when run script. example (cursor |):

$ bash test-gettext-read.sh insert word:| 

as workaround, remove trailing space in gettext string , add space outside:

echo -n $(gettext "insert word:")" " 

then works:

$ bash test-gettext-read.sh insert word: | 

my question: there better workaround?

thanks lot.

dont use echo -n.

simply this:

gettext "insert word: " read word 

or wrap expression whit quotes , pass echo:

echo -ne "$(gettext 'insert\ta\tword: ')" 

using quotes ensure result passed echo interpreted 1 parameter "insert word: " insteand of 3: 'insert' 'a' 'word:'.


Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -