I'm trying to make a script that enables proxy settings if the /etc/environment file is currently empty and disables the settings if the file has text. I've written some code but not sure why the /etc/environment file is not being edited. I have blanked out the actual proxies I am using. Any help would be greatly appreciated!
#!/bin/bash
if [ -s /etc/environment ]
then
cat<<EOT >> /etc/environment
http_proxy="blank"
https_proxy="blank"
ftp_proxy="blank"
export http_proxy https_proxy ftp_proxy
EOT
else
> /etc/environment
fi