i was going to cat a large snippet of shell code to ~/.zshrc file. i was expecting the original content will be showed in the ~/.zshrc file, but what i fond in the file is the result of the content been "rendered". I was expecting the original content in the file.
i was trying to add a single quotation out of the whole content. but that does not work, cause there are both single quotation and double quotation in the content.
below is my snippet of my code:
cat << EOF > ~/.zshrc
zsh_wifi_signal(){
local output=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I)
local airport=$(echo $output | grep 'AirPort' | awk -F': ' '{print $2}')
if [ "$airport" = "Off" ]; then
local color='%F{black}'
echo -n "%{$color%}Wifi Off"
else
local ssid=$(echo $output | grep ' SSID' | awk -F': ' '{print $2}')
local speed=$(echo $output | grep 'lastTxRate' | awk -F': ' '{print $2}')
local color='%F{black}'
[[ $speed -gt 100 ]] && color='%F{black}'
[[ $speed -lt 50 ]] && color='%F{red}'
echo -n "%{$color%}$speed Mbps \uf1eb%{%f%}" # removed char not in my PowerLine font
fi
}
EOF
what in the ~/.zshrc is something like:
zsh_wifi_signal(){
local output= agrCtlRSSI: -53
agrExtRSSI: 0
agrCtlNoise: -92
agrExtNoise: 0
state: running
op mode: station
lastTxRate: 702
maxRate: 867
lastAssocStatus: 0
802.11 auth: open
link auth: wpa2-psk
BSSID: 8c:a6:df:18:ac:5f
SSID: 99cloud_5G
MCS: 8
channel: 149,80
local airport=
if [ "" = "Off" ]; then
local color='%F{black}'
echo -n "%{%}Wifi Off"
else
local ssid=
local speed=
local color='%F{black}'
[[ -gt 100 ]] && color='%F{black}'
[[ -lt 50 ]] && color='%F{red}'
echo -n "%{%} Mbps \uf1eb%{%f%}" # removed char not in my PowerLine font
fi
which seems to be excuted.
i was expecting something like below in the ~/.zshrc file
zsh_wifi_signal(){
local output=$(/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport -I)
local airport=$(echo $output | grep 'AirPort' | awk -F': ' '{print $2}')
if [ "$airport" = "Off" ]; then
local color='%F{black}'
echo -n "%{$color%}Wifi Off"
else
local ssid=$(echo $output | grep ' SSID' | awk -F': ' '{print $2}')
local speed=$(echo $output | grep 'lastTxRate' | awk -F': ' '{print $2}')
local color='%F{black}'
[[ $speed -gt 100 ]] && color='%F{black}'
[[ $speed -lt 50 ]] && color='%F{red}'
echo -n "%{$color%}$speed Mbps \uf1eb%{%f%}" # removed char not in my PowerLine font
fi
}
i aslo start a issue in myrep