While executing the below script:
export var1="string('\n')"
echo $var1
I get the output as string(n)
. But I expect to see the output as : "string('\n')"
.
Is there any way to get that?
Note: I need the output to be displayed in string('\n')
(\n
in single quotes) to use that variable in m_wc abinitio
command.
Update: Thanks for responding quickly, but the variable text goes to next line when '\n' occurs. output below:
export var='string('\''\n'\'')'
export var1="string('\\n')"
echo "$var1"
string('
')
>echo $var
string('
')
Is there any way to escape the '\n' entirely?
Update : printf '%s\n' "$var1" seems to be working fine, but how can i put this value to a variable and use it anywhere in the script ?
I tried to put like below : but does not work:
export var1="string('\n')"
export var2="printf '%s\n' "$var1""
export BYT_CNT=m_wc -no-commas -string $var2 /prod/users/edw/gvx770/list.dat|awk '{print $1}'
echo $var2
echo $var2 printf '%s ' string(' ')