filter_var: filter data by specified filter
$var="https://www.google.com/"; if(filter_var($var, FILTER_VALIDATE_URL)){ echo $var . "正しいURL<br>"; } else { echo $var . "不正のURL<br>"; }
随机应变 ABCD: Always Be Coding and … : хороший
filter_var: filter data by specified filter
$var="https://www.google.com/"; if(filter_var($var, FILTER_VALIDATE_URL)){ echo $var . "正しいURL<br>"; } else { echo $var . "不正のURL<br>"; }
$var="10:53"; if($var === date('H:i', strtotime($var))){ echo $var . "正しい時間型<br>"; } else { echo $var . "不正の時間型<br>"; }
なんか、くだらないなーと思うのは私だけ??
$var="2019/2/19"; if(preg_match('/^([1-9][0-9]{3})\/([1-9]{1}|1[0-2]{1}|[0][1-9])\/([1-9]{1}|[1-2]{1}[0-9]{1}|3[0-1]{1}|[0][1-9])$/', $var)){ echo $var . "正しい日付<br>"; } else { echo $var . "不正の日付<br>"; }
ただ、これvarが2018/2/29でも、2019/2/29でも正しいって出てしまうし、30日しかない月でも31日って入力されてもOKになってしまうんだよね。
まーライブラリーであるんだろうけど。ロジックとしてはわかりました。
英字:[A-Za-z]
$var="My name is Tom"; echo preg_match("/[A-Za-z]/", $var);
数字:[0-9]
$var="My name is Tom, 19years"; echo preg_match("/[0-9]/", $var);
英数字:[A-Za-z0-9]
$var="今年の桜は綺麗ね"; echo preg_match("/[A-Za-z0-9]/", $var);
英数記号:!”\#$%&@'()*+,-./_
$var="hoge@gmail.com"; echo preg_match("/[\#$%&@'()*+,-._]/", $var);
$var="hoge@gmail.com"; echo preg_match("/[\s!-~]/", $var);
あれ!? ”\#$%&@'()*+,-._”と”\s!-~”、一緒だ。
すげーーーーーーーーーーーー
diffをした時に、違いのみ表示する。
[vagrant@localhost test]$ cat test.html
1 8411 東証1部 (株)みずほフィナンシャルグループ 03/28 1 71.1 -0.18% -0.3 96,741,900
2 8306 東証1部 (株)三菱UFJフィナンシャル・グループ 03/28 5 50.5 -0.56% -3.1 41,004,400
3 1357 東証ETF (NEXT FUNDS) 日経ダブルインバース上場投信 0 3/28 1,205 +2.99% +35 34,491,855
4 3765 東証1部 ガンホー・オンライン・エンターテイメント(株) 0 3/28 410 -3.53% -15 28,158,000
5 9437 東証1部 (株)NTTドコモ 03/28 2,417 -1.31% – 32 22,719,600 [vagrant@localhost test]$ ls
test.html work
[vagrant@localhost test]$ cp test.html copy.html
[vagrant@localhost test]$ ls
copy.html test.html work
[vagrant@localhost test]$ vi copy.html
[vagrant@localhost test]$ diff -y test.html copy.html
1 8411 東証1部 (株)みずほフィナンシャルグループ | 1 8 411 東証1部 みずほフィナンシャルグループ 03/28
2 8306 東証1部 (株)三菱UFJフィナンシャル・グルー 2 8 306 東証1部 (株)三菱UFJフィナンシャル・グルー
3 1357 東証ETF (NEXT FUNDS) 日経ダブルインバース上場 3 1 357 東証ETF (NEXT FUNDS) 日経ダブルインバース上場
4 3765 東証1部 ガンホー・オンライン・エンターテイメ 4 3 765 東証1部 ガンホー・オンライン・エンターテイメ
5 9437 東証1部 (株)NTTドコモ 03/28 2,417 \ 5 9 437 東証1部 (株)NTTドコモ 03/28 2,417
[vagrant@localhost test]$ diff -y –suppress-common-lines test.html copy.html
1 8411 東証1部 (株)みずほフィナンシャルグループ | 1 8411 東証1部 みずほフィナンシャルグループ 03/28
5 9437 東証1部 (株)NTTドコモ 03/28 2,417 \ 5 9437 東証1部 (株)NTTドコモ 03/28 2,417
ほう、なるほど~
Red-had DEPLOYMENT GUIDE
Deployment, Configuration and Administration of Red Hat Enterprise Linux 6
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/deployment_guide/
公式ドキュメントはこれか。しかし、文量あるから、一気に全部読むのはキツイな。まあ、ここも基本、というところか。。
$ sudo -V
Display the version of sudo command currently used.
[vagrant@localhost ~]$ sudo -V
Sudo バージョン 1.8.6p3
Sudoers policy plugin version 1.8.6p3
Sudoers file grammar version 42
Sudoers I/O plugin version 1.8.6p3
ん、なんだこれ?
$ sudo -l
Display command that the user can (or cannot) do on the current host by using the sudo command.
[vagrant@localhost ~]$ sudo -l
このホスト上でユーザー vagrant
に一致したデフォルト項目:
!visiblepw, always_set_home, env_reset, env_keep=”COLORS DISPLAY
HOSTNAME HISTSIZE INPUTRC KDEDIR LS_COLORS”, env_keep+=”MAIL PS1 PS2
QTDIR USERNAME LANG LC_ADDRESS LC_CTYPE”, env_keep+=”LC_COLLATE
LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES”,
env_keep+=”LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE”,
env_keep+=”LC_TIME LC_ALL LANGUAGE LINGUAS _XKB_CHARSET XAUTHORITY”,
secure_path=/sbin\:/bin\:/usr/sbin\:/usr/bin
ユーザー vagrant
は次のコマンドをこのホスト上で実行できます:
(ALL) NOPASSWD: ALL
$ sudo -h
Display help for sudo command.
$ sudo -u username hoge
Execute hoge command as a username
なんか、この辺は知らんとモグリと思われるな。
[vagrant@localhost test]$ WORK_DIR=work/$(date +%Y)/$(date +%m%d)_crontab
[vagrant@localhost test]$ ls
[vagrant@localhost test]$ mkdir -p ${WORK_DIR}
[vagrant@localhost test]$ ls
work
[vagrant@localhost test]$ ls
work
[vagrant@localhost test]$ cd work
[vagrant@localhost work]$ ls
2019
[vagrant@localhost work]$ cd 2019
[vagrant@localhost 2019]$ ls
0327_crontab
[vagrant@localhost 2019]$ cd 0327_crontab
[vagrant@localhost 0327_crontab]$ ls
[vagrant@localhost 0327_crontab]$ crontab -l > crontab.old
no crontab for vagrant
なるほど、コマンドラインでも変数として扱えるのね。ほう。
[vagrant@localhost ~]$ date
2019年 3月 26日 火曜日 09:15:51 JST
[vagrant@localhost ~]$ date “+%Y%m%d-%H%M%S”
20190326-091709
ふむ。
How to reflect changes after editing the contents of crontab file directly. There is no need to restart cron after changing crontab.
On Linux, it checks the modification time of cron every minute and reloads if there is a change, so change of the file of cront if you do, your changes will take effect immediately without having restart cron.
/var/spool/cron
[vagrant@localhost ~]$ /etc/rc.d/init.d/crond status
crond (pid 2614) を実行中…