This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
bash_scripts [2021/08/17 00:54] admin created |
bash_scripts [2025/03/17 13:35] (current) admin |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Bash Scripts ====== | ====== Bash Scripts ====== | ||
| + | |||
| + | ===== Getting current date ===== | ||
| + | <code current_date.sh> | ||
| + | #!/bin/bash | ||
| + | DATE=$(date +"%Y-%m-%d") | ||
| + | echo $DATE | ||
| + | </code> | ||
| ===== Extracting compressed files ===== | ===== Extracting compressed files ===== | ||
| Line 50: | Line 57: | ||
| esac | esac | ||
| + | </code> | ||
| + | |||
| + | ===== Spell checking a website ===== | ||
| + | This was by request. A user had a website and wanted to run spell check on it. This is simple, just run: | ||
| + | <code bash> | ||
| + | aspell -H -c filename.php | ||
| + | </code> | ||
| + | The ''-c'' asks aspell to check, and the ''-H'' prepares it for HTML (it skips class names and php tags etc). | ||
| + | |||
| + | aspell only takes one filename at a time, but you can run through each file in a loop using: | ||
| + | <code bash> | ||
| + | for i in *.php; do aspell -c $i; done | ||
| </code> | </code> | ||