This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
By default, everyone is allowed to create cron and at jobs. | |
However, users can be denied if explicitly listed in one of the .deny files: at.deny or cron.deny. | |
These are both located in /etc by default. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\!h at format | |
in the command line type: | |
at <time> <date> e.g noon tomorrow or 11am june 26 | |
this opens an at> prompt. Type in commands to be executed. | |
CTRL+D to end job definition - the new job is now set | |
atq - to list jobs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crontab -e | |
5 20 * * 1-5 root /usr/sbin/backup.sh | |
\!h Seven fields: | |
- Minute (0-59): 5 past the hour | |
- Hour (0-23): 8pm | |
- Day of the Month (0-31): any day | |
- Month (1-12): any month | |
- Day of the Week (0-7): Mon-Friday |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The part of the string that matches the pattern is automatically stored in $& | |
if ("Hello there, neighbor" =~ /\s(\w+),/) { | |
print "That actually matched '$&'.\n"; | |
} | |
# In the above example, the part that matched was " there," (a space, a word, and a comma). | |
# In comparison, capture $1 would have just the five-letter word. | |
# Whereas, $& has the entire matched section. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example: | |
# Before - bronto is $1 and what we want is $2. This will get confusing in more complicated patterns | |
if ((/bronto)?saurus (steak|burger)/) { | |
print "Fred wants $2\n"; | |
} | |
# After - now using noncapturing parentheses around bronto | |
if (/(?:bronto)?saurus (steak|burger)/) { | |
print "Fred wants $1\n"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (/bronto)?saurus (steak|burger)/ { | |
print "Antisa wants a $2\n"; | |
} | |
# Even if bronto is not there, its part of pattern that goes into $1. | |
# You can refer back to a labeled group using \g{label}: | |
my $names = 'Fred Flintstone and Wilma Flintstone'; | |
if ($names =~ m/(?<last_name>\w+) and \w+ \g{last_name}/) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /a - use the ASCII interpretation | |
# /u - use the Unicode interpretation | |
# /l - respect the locale | |
# A single /a modifier affects the character class shortcuts, | |
# but having two /a modifiers also tells Perl to use ACII-only case-folding. | |
\!h # Some examples: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\!h # Example, allows for code spacing: | |
/-?[0-9]+\.?[0-9]/ # - without | |
/ -? [0-9] + [0-9]* /x # - with |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\!h # To match a particular property, you put the name in \p{PROPERTY} | |
# Example - to match any sort of space, use the 'Space' property: | |
if (/\p{Space}/) { | |
print "The string has some whitespace.\n"; | |
} | |
# The above is slightly more expansive than \s as it matches more properties, like NEXT LINE or LINE TABULATION (vertical line). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\!h # Some basic shortcuts: | |
# \s meaning any whitespace | |
$_ = "fred \t \t barney"; | |
if (/fred\s+barney/) { | |
print "It matched!\n" | |
} | |
# \h can be used for horizontal whitespace only |
NewerOlder