Shell script frequently used commands

Note frequently used commands in shell scripts.

Execute command in certain directory without changing current path
#!/bin/bash
# Command running in terminal directly, your current working directory won't change.
$ cd ./folder/path && ls -l

# Command running inside a shell script file. example.sh
sh `cd ./folder/path && ls -l`;
Reference

Scroll to Top