如何把一堆stdout的數字運算後再stdin? - Linux

By Freda
at 2012-06-02T19:53
at 2012-06-02T19:53
Table of Contents
舉個fdisk的例子,
fdisk -lu /dev/sda|grep ^/dev/sda|cut -c 29-37
690794
94638914
10458314
29993354
35262674
36049859
94638914
現在我想把每一個數字扣掉16666
echo $((`fdisk -lu /dev/sda|grep ^/dev/sda|cut -c 29-37`-16666))
zsh: bad math expression: operator expected at `94638914\n ...'
我希望運算後的每一項當成stdin給dd當成參數但光是運算就卡死了,連echo
都出不來,請問這部分要怎模解決?
--
太初有道,道與耶和華同在,道就是耶和華。這道太初與耶和華同在。
萬物乃藉祂所造,凡被造的沒有一樣不是藉著祂所造的。生命在祂裡頭,
這生命就是人的光。光照在黑暗裡,黑暗卻不接受光。
吾輩乃生於黑暗,行於黑暗。因神之指引,行向光明;又因撒旦誘惑,回歸黑暗。
我不斷地徘徊於光明與黑暗之間,從被造之日至今,又自今直到那審判之日的來臨。
--
fdisk -lu /dev/sda|grep ^/dev/sda|cut -c 29-37
690794
94638914
10458314
29993354
35262674
36049859
94638914
現在我想把每一個數字扣掉16666
echo $((`fdisk -lu /dev/sda|grep ^/dev/sda|cut -c 29-37`-16666))
zsh: bad math expression: operator expected at `94638914\n ...'
我希望運算後的每一項當成stdin給dd當成參數但光是運算就卡死了,連echo
都出不來,請問這部分要怎模解決?
--
太初有道,道與耶和華同在,道就是耶和華。這道太初與耶和華同在。
萬物乃藉祂所造,凡被造的沒有一樣不是藉著祂所造的。生命在祂裡頭,
這生命就是人的光。光照在黑暗裡,黑暗卻不接受光。
吾輩乃生於黑暗,行於黑暗。因神之指引,行向光明;又因撒旦誘惑,回歸黑暗。
我不斷地徘徊於光明與黑暗之間,從被造之日至今,又自今直到那審判之日的來臨。
--
Tags:
Linux
All Comments

By Sandy
at 2012-06-05T19:11
at 2012-06-05T19:11

By Agatha
at 2012-06-10T03:23
at 2012-06-10T03:23

By Rae
at 2012-06-13T21:45
at 2012-06-13T21:45

By Ivy
at 2012-06-17T10:43
at 2012-06-17T10:43

By Jacob
at 2012-06-21T09:27
at 2012-06-21T09:27

By Dinah
at 2012-06-21T19:46
at 2012-06-21T19:46

By Queena
at 2012-06-23T19:03
at 2012-06-23T19:03

By Bennie
at 2012-06-24T02:44
at 2012-06-24T02:44

By Tom
at 2012-06-26T13:11
at 2012-06-26T13:11

By Kama
at 2012-06-28T07:57
at 2012-06-28T07:57
Related Posts
剛剛在八卦看到有人在討論Win8的優點 XD

By Linda
at 2012-06-02T13:06
at 2012-06-02T13:06
Linux下跑deluge的問題

By Eden
at 2012-06-02T04:26
at 2012-06-02T04:26
對於圖形介面的想法...

By Oliver
at 2012-06-01T20:26
at 2012-06-01T20:26
Ubuntu 12.04 更新管理員問題

By John
at 2012-06-01T19:34
at 2012-06-01T19:34
檔案太多,導致處理速度很慢

By Michael
at 2012-06-01T06:49
at 2012-06-01T06:49