Execute command from file in current shell

Posted by Pandya on Ask Ubuntu See other posts from Ask Ubuntu or by Pandya
Published on 2014-08-24T13:02:50Z Indexed on 2014/08/25 4:31 UTC
Read the original article Hit count: 377

I want to executed command from file (which is script) in current shell in terminal.

Example: I have file ch_dir contains following:

#!/bin/bash
cd /usr

Now if I execute file usually as following then it executes commands in different shell:

pandya@pandya-desktop:~$ ./ch_dir
pandya@pandya-desktop:~$

Here cd /user is executed in different shell.

But I want to execute in Current shell. How do I do that?

Note: Here cd is only used to explain. Question's aim is to execute any command in current shell

© Ask Ubuntu or respective owner

Related posts about command-line

Related posts about shell-scripting