So I am using my laptop that switch between different networks, my work and my home network.
The business network is behind a firewall so I need to activate the proxy options on my browser (opera). To activate before opening the browser I can edit the configuration script.
the script will have many lines but I will have something like this.
Code:
Use HTTP=1
Use HTTPS=1
Use FTP=1
So I used vim and do a search and replace on the fly.
Code:
vim -c "566" -c "s/1/0/"
-c "567" -c "s/1/0/"
-c "568" -c "s/1/0/"
-c "wq" $file;
The problem is that this won't work. I am triying to have
script_name [ On | Off]. The problem is that for some reason is not working. The command like that will work, but once I wrap it up under if I don't get an error but nothing happen.
Code:
#!/bin/bash
file="/home/user/.opera/opera6.ini"
if [ $# -eq 0 ]; then
echo " Please insert an option,"
echo " on - Activates Opera proxy"
echo " off - Deactivate opera proxy"
fi
if [ $# == "Off" ]; then
vim -c "566" -c "s/1/0/"
-c "567" -c "s/1/0/"
-c "568" -c "s/1/0/"
-c "wq" $file;
fi
if [ $# == "On" ]; then
vim -c "566" -c "s/0/1/"
-c "567" -c "s/0/1/"
-c "568" -c "s/0/1/"
-c "wq" $file;
fi
Am I doing something work on the statement part within the if?