shell script 變數的預設值


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /pub/websites/318/weblog/wordpress/wp-content/plugins/wp-syntax/wp-syntax.php on line 380

[客家話, hak-Hant-TW]

有這種需要,尋一下網路看到這篇有寫,試捯毋會麻煩,記一下。

#!/bin/sh
$DEFAULT_VAR="VALUE"
VAR="${VAR-$DEFAULT_VAR}"

Leave a Reply

Your email address will not be published. Required fields are marked *