Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:utility-scripts:chttl [2025/01/05 23:19] – Webmaster VitaNetworks | en:utility-scripts:chttl [2025/01/06 00:46] (current) – Webmaster VitaNetworks | ||
|---|---|---|---|
| Line 10: | Line 10: | ||
| ===== Is there something else? ===== | ===== Is there something else? ===== | ||
| - | - This is the first [intentionaly] POSIX-compliant script we've ever written. | + | - This is the first [intentionaly] POSIX-compliant script we've ever written.\\ |
| - | - It works on macOS, Linux and FreeBSD. | + | - It works on macOS, Linux and FreeBSD.\\ |
| - | - It can be used to set the value back to where it was as well, simply add it at the end. | + | - It can be used to set the value back to where it was as well, simply add it at the end.\\ |
| - | - It's not a permanent modification. | + | - It's not a permanent modification.\\ |
| - | Depending on the OS, you might need to create a file in a specific location or issue a special command that sets preference files. | + | |
| ==== Make it a function ==== | ==== Make it a function ==== | ||
| - | This was originally written as a bash function. It was changed early on to '' | + | This was originally written as a bash function. It was changed early on to '' |
| - | You only need to remove | + | === Using a functions file === |
| + | As a login shell, bash process config files in the following order: | ||
| + | - ''/ | ||
| + | - '' | ||
| + | - '' | ||
| + | - '' | ||
| + | Typically '' | ||
| + | '' | ||
| + | (meaning "//if '' | ||
| + | You may follow the bash's own example by invoking the functions file from '' | ||
| + | < | ||
| + | [Sun05@23: | ||
| + | total n | ||
| + | 24 -rw------- | ||
| + | 8 -rw-r-xr-x@ | ||
| + | ######################################################################################################## | ||
| + | #↑↑↑ Add 'if [ -f " | ||
| + | ######################################################################################################## | ||
| + | 8 -rw-r--r-- | ||
| + | 8 -rw-r-xr-x@ | ||
| + | 0 drwx------ | ||
| + | 16 -rw-r-xr-x@ | ||
| + | 0 drwxr-xr-x | ||
| + | |||
| + | [Sun05@23: | ||
| + | total n | ||
| + | 0 drwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 0 drwxr-xr-x | ||
| + | 0 drwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 16 -rwxr-xr-x@ | ||
| + | ######################################################################################################## | ||
| + | # | ||
| + | ######################################################################################################## | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 40 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x@ | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 64 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x@ | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 40 -rwxr-xr-x | ||
| + | 48 -rwxr-xr-x | ||
| + | 32 -rwxr-xr-x@ | ||
| + | 24 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 16 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 40 -rwxr-xr-x@ | ||
| + | 176 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | 8 -rwxr-xr-x | ||
| + | </ | ||
| ===== Syntax ===== | ===== Syntax ===== | ||
| The script takes one or no arguments; any additional argument(s) after the first one should be ignored. | The script takes one or no arguments; any additional argument(s) after the first one should be ignored. | ||