I can reverse tether now by using alias but it stops on adb shell command
This is more of a linux question, and it may need to be moved to superuser.se, but I can answer it.

On linux, you string commands using &amp;&amp; (or || or just ;). With &amp;&amp;, the first command must finish executing and have no error codes in order for the next command in the sequence to run.

In your setup, it looks like you want to open an ADB shell, and then run netcfg rndis0 dhcp on the adb shell. However, Linux doesn't do that. Instead, it is waiting for the ADB shell to exit without errors, after which time it will run netcfg rndis0 dhcp on the desktop computer's shell.

If you want to run a command on the Android device, you don't start an interactive ADB shell (the default); rather, you pass the command like so:


  adb shellnetcfg rndis0 dhcp


You'll need to change your alias for n to be a variable instead. Remove the alias directive so the line just reads n='netcfg rndis0 dhcp'. Then change your alias for t to be as follows


  alias t='r &amp;&amp; sh $n'