Cancel

File Importing in bash

You can import a file in bash using the source command.

Create few variables in vars file, so you can use these variables later on inside the different files.

1
2
first_name="Yafiz"
last_name="Abraham"

Now import the file call vars using source command, and then finally you can call these variables.

1
2
3
4
#!/bin/bash

source ./vars
echo "\$first_name, \$last_name"