[Linux]变量加减赋值以及将String转int
teddy@toshiba~$a="76"
teddy@toshiba~$echo$((a+3))
79
teddy@toshiba~$echo$((a-12))
64
teddy@toshiba~$
取文件名以及文件路径的脚本:
#!/bin/sh
tmp=$1
filename=`echo$1|awk-F/'{print$(NF)}'`
echo"filename":$filename
filenamelength=`echo|awk'{printlength("'${filename}'")}'`
totallength=`echo|awk'{printlength("'${tmp}'")}'`
length=`echo$((totallength-filenamelength))`
filepath=`echo$tmp|cut-c-$length`
echo"filepath":$filepath
调用方式:
eamon@dxeamon:~/tmp$sha.sh1/2/3/4/5/6
filename:6
filepath:1/2/3/4/5/
相关推荐
laisean 2020-11-11
Julyth 2020-10-16
laisean 2020-09-27
flycappuccino 2020-09-27
liguojia 2020-09-27
87201442 2020-10-15
MXstudying 2020-09-05
WasteLand 2020-09-15
<?php. if (!empty($_POST)) {. $data1 = $_POST["data1"];$data2 = $_POST["data2"];$fuhao = $_POST["fuh
mathchao 2020-09-15
tvk 2020-07-30
Zaratustra 2020-07-29
zhaowj00 2020-07-26
Zaratustra 2020-06-26
ldcwang 2020-06-25
拿什么来拯救自己 2020-06-21
IsanaYashiro 2020-06-16
赵家小少爷 2020-06-14
大牛牛 2020-06-14