This script will delete 10 days old files and send folder list via mail. You can change the value“-mtime X”depending on your requirement. Also, replace your email id instead of us. # /opt/script/delete-old-files.sh #!/bin/bash ...
Here, we list some basic bash syntax with a brief explanation. It is a good starting point if you are a beginner.
f1 -nt f2 file f1 is newer than f2. f1 -ot f2 file f1 is older than f2 Comparison Operators Comparison operators are used in bash to compare two strings to check if they are equal or not. Here, we will list some comparison operators including, string, and integer operators. Integer ...
forx := 1 to 10dobegin statements endforname [in list]dostatements that can use$namedonefor((initialisation ; ending condition ; update))dostatements...done whileSyntax: whilecondition;dostatementsdone untilSyntax: untilcondition;dostatementsdone ...
This principle can be used with all of PacUI's options. Here is another random example (of PacUI's hidden "List Packages by Size" option): pacui LS pacui -LS pacui --LS pacui ls pacui -ls pacui --ls Start PacUI without UI: Using Options and Package Names You can also use ...
If this variable is in the environment when bash starts up, each shell option in the list will be enabled before reading any startup files. This variable is read-only. BASHPID Expands to the process id of the current bash process. This differs from $$ under certain circumstances, such as...
Here is a function that allows you to list all files that were last modified on the date you give as argument. Once again, we choose a function for speed reasons. No pun is intended by the function’s name: function lsd { date=$1 ls -l | grep -i "^.\{42\}$date" | cut -c5...
build a list of all dirs first and reuse it so not to have to crawl the path/to/dirs directory tree for each icon make cp builtin to remove the cost of forking a process and executing an external command for each copy do Not order the globs as we don't really need them to be ...
Since every normal directory contains a.and.., you don’t need to see those.You can usels -Ato list all the files in a directory except those two. For other commands where you list files with a wildcard (i.e., pattern), youcan construct your wildcard in such a way that.and..don...
print -rC1 -- *.fits(N) > output_all.txt Where N enables nullglob for that one glob and print -rC1 prints its arguments raw on 1 Column, and importantly here: prints nothing if not passed any argument. With zsh, you can also restrict the list to regular files only (...