1、获取字符串长度
abc="huihuiuhiihu"
echo ${#abc}
利用#号实现字符串长度统计
2、截取字符串内容
${hui:5}
利用:加数字的形式截取固定长度字符串内容
3、实现固定长度字符串拼接
hui="sssdsdsdsjkdhskhdksd"
abc="12346"
kji=${abc}${hui:${#abc}}
echo $kji
1、获取字符串长度
abc="huihuiuhiihu"
echo ${#abc}
利用#号实现字符串长度统计
2、截取字符串内容
${hui:5}
利用:加数字的形式截取固定长度字符串内容
3、实现固定长度字符串拼接
hui="sssdsdsdsjkdhskhdksd"
abc="12346"
kji=${abc}${hui:${#abc}}
echo $kji
1、叙述
脚本的好处是便捷、高效,拿起来就可以写,写完就能跑,都不用编译。但坏处也显而易见,一些敏感的、不想让外人知道的东西都是明文写在里面的。
2、安装shc编译器
下载安装:
tar xzvf shc.tar.tgz
cd shr/
make && make install
直接安装:
sudo apt install shc
3、使用方法
shc -r -f ./demo.sh
运行成功后会在当前目录下生成两个文件:
demo.sh.x 是脚本所对应的可执行程序
demo.sh.c 对应的c语言实现的源码
4、参数列表:
The command line options are:
-e date
Expiration date in dd/mm/yyyy format [none]
-m message
message to display upon expiration ["Please contact
your provider"]
-f script_name
File name of the script to compile
-i inline_option
Inline option for the shell interpreter i.e: -e
-x comand
eXec command, as a printf format i.e:
exec(\\'%s\\',@ARGV);
-l last_option
Last shell option i.e: --
-r Relax security. Make a redistributable binary which
executes on different systems running the same operat-
ing system.
-v Verbose compilation
-D Switch on debug exec calls
-T Allow binary to be traceable (using strace, ptrace,
truss, etc.)
-C Display license and exit
-A Display abstract and exit
-h Display help and exit