To better understand the bash special variables, I wrote a script to help myself. #!/bin/bash #Usage of $#echo ------------------------------------------------------------echo -e You have entered $# arguments. #Usage of $*echo ------------------------------------------------------------export IFS='-'echo -e The arguments are: "$*" \(seperated by -\) #Usage of $@echo ------------------------------------------------------------n=1for arg in "$@"do echo -e The $n argument is: "$arg" let n+=1done #Usage … Continue reading Bash Special Variables
Tag: Bash
Ubuntu Wallpaper of the Day
My inspiration of the 'Wallpaper of the Day' comes from the Nation Geographic Photo of the Day. National Geographic recommends an amazing photo each day on this web site. I wrote a bash script to automatically set the photo as my desktop background everyday when I start my Ubuntu laptop. Create the following script then add … Continue reading Ubuntu Wallpaper of the Day
Auto deploy Puppet Agent
Continue with my previous Puppet and Puppet dashboard installation, now I start to deploy the agent to all my Ubuntu desktops. I wrote a script to do the dirty work. Pre-requisite package: expect (no need if use passwordless ssh, but you need to change the script slightly). How to use: 1) Create the following 4 scripts … Continue reading Auto deploy Puppet Agent
Fortinet SSL VPN Client in Ubuntu
It is intereting that the Fortinet SSL VPN client works fine in my Windows machine, but does not work in my Ubuntu laptop. I have found the reason is that a few routes are missed in the routing table. To make it work, I wrote a script to manually add those routes after VPN is … Continue reading Fortinet SSL VPN Client in Ubuntu
Auto Configure Proxy in Ubuntu
It is painful to turn the proxy on and off in my Ubuntu laptop between office and home. As a lazy guy, I would like to make it automatic. Easy life now 🙂 1) Create 3 scripts named proxy_on, proxy_off and check_proxy under /usr/local/bin. #!/bin/bash #proxy_on gsettings set org.gnome.system.proxy.socks host 'proxy.company.local' gsettings set org.gnome.system.proxy.socks port … Continue reading Auto Configure Proxy in Ubuntu