關於macbook bash 的 printf - Linux

By Michael
at 2017-01-15T20:55
at 2017-01-15T20:55
Table of Contents
目前是使用macbook練習bash指令
想請教linux的前輩們
prinf指令中,有一個’n$’格式
man page 文件解釋此格式可以自訂排序顯示後面引數(n:代表第幾個引數)
也就是說:
(intput)
printf "%s, %s" "first" "second"
(output)
first, second
加入n$格式:
(input)
printf "%2$s, %1$s" "first" "second"
(output)
second, first
網路上找到的例子也都是如此使用
可是macbook卻出現錯誤訊息:
-bash: printf: `$': invalid format character
這是為什麼呢??
--
Tags:
Linux
All Comments

By Robert
at 2017-01-20T17:51
at 2017-01-20T17:51

By Susan
at 2017-01-21T04:15
at 2017-01-21T04:15

By Ophelia
at 2017-01-21T20:41
at 2017-01-21T20:41

By Adele
at 2017-01-22T21:46
at 2017-01-22T21:46

By John
at 2017-01-27T02:53
at 2017-01-27T02:53

By Una
at 2017-01-28T16:54
at 2017-01-28T16:54

By Belly
at 2017-02-01T06:46
at 2017-02-01T06:46

By Sarah
at 2017-02-04T12:51
at 2017-02-04T12:51

By Lily
at 2017-02-07T05:48
at 2017-02-07T05:48

By Queena
at 2017-02-10T18:43
at 2017-02-10T18:43

By Skylar Davis
at 2017-02-15T08:51
at 2017-02-15T08:51

By Zanna
at 2017-02-16T12:53
at 2017-02-16T12:53

By Caroline
at 2017-02-18T05:02
at 2017-02-18T05:02

By Irma
at 2017-02-19T09:04
at 2017-02-19T09:04
Related Posts
含有GPS driver的Kernel時間疑問!

By Sandy
at 2017-01-15T03:55
at 2017-01-15T03:55
ubuntu 學術網路問題

By Harry
at 2017-01-14T23:48
at 2017-01-14T23:48
求推薦USB Gigabit LAN

By James
at 2017-01-14T23:23
at 2017-01-14T23:23
apache-mod-markdown

By Enid
at 2017-01-13T20:33
at 2017-01-13T20:33
-請問expect怎麼送出方向鍵

By Elizabeth
at 2017-01-12T15:31
at 2017-01-12T15:31