LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   typeset in linux (https://www.linuxquestions.org/questions/linux-newbie-8/typeset-in-linux-4175479872/)

byran cheung 10-07-2013 01:11 AM

typeset in linux
 
I use type in ksh ,

typeset -Ln

command under AIX to do the following:

Left-justify. Remove leading spaces; if n is given, fill with spaces or truncate on right to length n."


Somehow under Linux this not working ...

Any ideas what I have to use here instead ?

pan64 10-07-2013 01:41 AM

probably because you use bash (try echo $0). You can try ksh on linux too - if installed. In bash I think you need to use printf (see man page)

byran cheung 10-07-2013 02:34 AM

Quote:

Originally Posted by pan64 (Post 5041305)
probably because you use bash (try echo $0). You can try ksh on linux too - if installed. In bash I think you need to use printf (see man page)

thx reply ,

my current question is I have set a variable , similar as below

VAT=$(grep ...)
echo $VAT
"
"

The problem now is the display of $VAT is not tidy , I would like to set the $VAT displaying in left n line "Ln" , how to do it ? thanks

pan64 10-07-2013 02:56 AM

see man bash and look for printf formatting
printf -v VAT "%6s" "$VAT"


All times are GMT -5. The time now is 07:34 AM.