簡體   English   中英

如何從 bash 中的“讀取”中讀取 arguments?

[英]How do I read arguments from “read” in bash?

標題所說的是我的問題,如何檢查並從“讀取語句”中獲取 arguments 到 $1、$2 等...

您可以使用set來設置位置參數的值。

$ read a b <<< "hello world"
$ set -- "$a" "$b"
$ echo "$1"
hello
$ echo "$2"
world

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM