Monday, May 14, 2012

Include variables to a shell script from an external script

file1 include.sh

#!/bin/bash
var1="Hello there"

file2 includetest.sh

#!/bin/bash
. include.sh
echo $var1
#file2 has access to all variables defined in file1


>>>>Run file2 and you see the required output.
>>chmod +x includetest.sh
>>./includetest.sh

Mount a LAN resource in cmd

My need led me to think about this problem. I had to run an application from sources when I had the source code on a machine connected to my network(LAN). Due to some problem I didn't want to copy the source code on my machine. I took the following steps:-

 1)mount the LAN resource:-
 >>>net use z: \\192.168.x.x\shared_folder
 Now z drive is a virtual drive on your machine.

 2)Set all your environment variables referring z drive.

 The above two steps makes you all set to run the application from sources that is present on a LAN resource.
There are many other such utilities with "net" command. Check them, You may find them beneficial too.