我正在做一个别名函数,它返回一些注释,这些注释使我想起需要为不同功能运行的别名,例如:
echo 'sendToDropBox "localFile", "remoteDir" # send a local file to dropbox '
echo 'evernote "title", "conte/file", "notebook_name" # send to evernote, notebook_name is optional'
我希望内容从#
对齐开始。我搜索了列,但它们似乎仅适用于来自文件的数据。我尝试了这个:
printf "%s\n" "this is a test" | column -t
但这只是字眼之间的间隔。我如何获得此输出
ToDropBox "localFile", "remoteDir" # send a local file to dropbox
evernote "title", "conte/file", "notebook_name" # send to evernote...
tweet "book", "tweet" # post a tweet...
您可以使用printf
格式:
printf "%-35s %s\n" "line1" "# comment" "line2" "# other comment"
%-35s
显示第一个变量时保留35个字符(-
用于左对齐)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句