LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-07-2013, 02:11 AM   #1
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Rep: Reputation: Disabled
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 ?
 
Old 10-07-2013, 02:41 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

Rep: Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267Reputation: 2267
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)
 
Old 10-07-2013, 03:34 AM   #3
byran cheung
Member
 
Registered: Sep 2013
Posts: 321

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by pan64 View Post
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
 
Old 10-07-2013, 03:56 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ksh typeset bug? vgoel Programming 2 12-19-2010 07:16 PM
typeset tostay2003 Programming 2 08-08-2008 12:13 AM
Typeset issues Asadullah Rathore Linux - General 1 09-24-2005 01:07 PM
typeset issues in ksh talalrabbani Linux - Distributions 0 09-23-2005 01:13 AM
typeset not working XST1 Programming 3 02-07-2005 12:29 AM


All times are GMT -5. The time now is 06:25 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration