0

I am making an alias function where it returns some comments which remind me of what alias I need to run for different functionality, this is as example :

echo 'sendToDropBox "localFile", "remoteDir"  # send a local file to dropbox ' 
echo 'evernote "title", "conte/file", "notebook_name"  # send to evernote, notebook_name is optional'

I want the content starting from # to align. I searched columns, but they only seem to work with data coming from a file. I tried this :

printf "%s\n" "this is a test" | column -t

But that just spaces the words. How can I get this output

ToDropBox "localFile", "remoteDir"               # send a local file to dropbox
evernote "title", "conte/file", "notebook_name"  # send to evernote...
tweet "book", "tweet"                            # post a tweet...

1 Answer 1

1

You can use printf formatting :

printf "%-35s %s\n" "line1" "# comment" "line2" "# other comment"

%-35s reserve 35 characters when displaying first variable (- for left align).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.