0

I'm writing a shell script. what it does is it will create a file by the input that is received from the user. Now, i want to add the feature called "view a file" for my current script. Now, it's unreasonal to retype it again since i've already had a script that helps

I know it's crazy when it is possible to it with normal shell command. I'm actually writing a script that help me to create pages that are generated from the touch command. (this pages had attached date, author name, subjects, and title).

The question is how to call a another script or inhere another script?

1

1 Answer 1

1

Couple of ways to do this. My prefered way is by using source You can -

  • Call your other script with the source command (alias is .) like this: source /path/to/script.

  • Make the other script executable, add the #!/bin/bash line at the top, and the path where the file is to the $PATH environment variable. Then you can call it as a normal command.

  • Use the bash command to execute it: /bin/bash /path/to/script

Sign up to request clarification or add additional context in comments.

1 Comment

The second way sounds really ergonomic and something is more intuitive in programming. Thanks a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.