Viewing 1 to 3 of 3 items
Tag Archives: Current

sh current_dir

Assuming you’re using bash #!/bin/bash current_dir=$(pwd) script_dir=$(dirname $0) echo $current_dir echo $script_dir This script, when ran, should print the directory that you’re in, and then the directory the script is in, for example, when calling it from / (the script is in /home/mez/), it outputs / /home/mez Remember, when assigning variables from the output of  Full Article…


display how many files that user accessed

All of these commands can be used inside of your scripts and can make for a very powerful toolset for developing programs in unix. For an example of using these commands in a script, let’s write a script that uses our current data file. The script will get all users that are in the file  Full Article…