- 一般 Hash 情況是這樣:
hash = {}
hash[:foo][:bar] = :hello
=> NoMethodError: undefined method `[]=' for nil:NilClass
請建立一個 Hash 可以不管 key 值是否存在都可以自動設定 key 及 value
hash = {}
hash[:foo][:bar] = :hello
=> NoMethodError: undefined method `[]=' for nil:NilClass
請建立一個 Hash 可以不管 key 值是否存在都可以自動設定 key 及 value
I hereby claim:
To claim this, I am signing this object:
#!/bin/bash | |
# Checking whether user has enough permission to run this script | |
sudo -n true | |
if [ $? -ne 0 ] | |
then | |
echo "This script requires user to have passwordless sudo access" | |
exit | |
fi |
I hereby claim:
To claim this, I am signing this object: