run a shell script from a shell script code example

Example 1: How to call one shell script from another shell script?

#!/bin/bash

#By Andrei Krasutski

SCRIPT_PATH="/path/to/script.sh"

# Here you execute your script
"$SCRIPT_PATH"

# or
. "$SCRIPT_PATH"

# or
source "$SCRIPT_PATH"

# or
bash "$SCRIPT_PATH"

# or
eval '"$SCRIPT_PATH"'

# or
OUTPUT=$("$SCRIPT_PATH")
echo $OUTPUT

# or
OUTPUT=`"$SCRIPT_PATH"`
echo $OUTPUT

# or
("$SCRIPT_PATH")

# or
(exec "$SCRIPT_PATH")

Example 2: how to execute .sh file in linux

./script-name-here.sh #Chage the "script-name-here" to the name of the .sh file.