echo

简化gdb脚本

*爱你&永不变心* 提交于 2019-12-26 08:12:49
  每次调试都是先PS x|grep xxxx ,然后gdb attach pid ,太麻烦了!写了个烂脚本给自己减负~~~ 1 #!/bin/bash 2 3 #check num of argv 4 5 if [[ $# -ne 1 ]]; then 6 echo 'err: argv num!' 7 exit 8 fi 9 10 #deal string 11 var_argv=$1 12 var_name=`echo $var_argv| tr -d "/"` 13 var_pid_name=${var_argv}'IM'${var_name} 14 15 ret_var=`ps -x |grep $var_pid_name |grep -v grep | awk '{print $1}'` 16 17 #string to array 18 arr_out=() 19 arr=(${ret_var/' '/ }) 20 21 for i in ${arr[@]} 22 do 23 arr_out[${#arr_out[@]}]=$i 24 done 25 26 27 #Determines that the string length 28 29 len_arr=${#arr_out[@]} 30 31 if [[ $len_arr -ne 1 ]];then 32

批处理命令——choice

风格不统一 提交于 2019-12-26 06:52:13
【1】choice命令简介   使用此命令可以提示用户输入一个选择项,根据用户输入的选择项再决定执行具体的过程。   使用时应该加 /c: 参数,c: 后应写提示可输入的字符或数字,之间无空格。冒号是可选项。   使用时加也可选择加/m:参数,m:后应写提示说明语。   具体的命令使用请参见choice/? 如下图所示:   choice命令使用详细如上。 【2】应用示例   常用情况,简单举例如下:新建一个文本文件,命名为choicedemo,修改文件类型为bat,用Notepad++打开编辑内容如下: 1 @echo off 2 :begin 3 choice /c:1234 /m:"please select" 4 if %errorlevel%==4 goto end 5 if %errorlevel%==3 goto three 6 if %errorlevel%==2 goto two 7 if %errorlevel%==1 goto one 8 :one 9 echo 111 10 pause>nul 11 goto begin 12 :two 13 echo 222 14 pause>nul 15 goto begin 16 :three 17 echo 333 18 pause>nul 19 goto begin 20 :end 21 echo I want

Shell 中 Map 使用

∥☆過路亽.° 提交于 2019-12-26 06:13:42
定义一个空 Map declare -A map=() 定义时初始化 Map declare -A map=(["a"]="1" ["b"]="2") 输出所有 key echo ${!map[@]} 输出所有 value echo ${map[@]} 添加值 map["c"]="3" 输出 key 对应的值 echo ${map["a"]} 遍历 Map for key in ${!map[@]} do echo ${map[$key]} done 找到就删除,没找到就新增 if [ ! -n "${map[$key]}" ] then map[$key]=$value else echo "find value" unset map[$key] fi 来源: CSDN 作者: 大漠知秋 链接: https://blog.csdn.net/wo18237095579/article/details/103696167

PHP无限极分类原理

我怕爱的太早我们不能终老 提交于 2019-12-25 19:02:21
1.递归:程序调用自身的编程技巧称为递归 2.案例: /** * @param 递归 $[name] */ function deeploop(&$i=1){ echo $i; $i++; if($i < 10){ deeploop($i); } } deeploop(); 结果:123456789 3.global /** * @param 递归 $[name] */ $i = 1; function deeploop(){ global $i; //Global的作用是定义全局变量,但是这个全局变量不是应用于整个网站,而是应用于当前页面,包括include或require的所有文件。 echo $i; $i++; if($i < 10){ deeploop($i); } } deeploop(); 4.static /** * @param 递归 $[name] */ function deeploop(){ static $i; echo $i; $i++; if($i < 10){ deeploop($i); } } deeploop(); 5.说白了递归就是一个循环,用循环实现和递归实现是同样的效果。 /** * @param 递归 $[name] */ for($i=1;$i<10;$i++){ echo $i; } function deeploop(){

Can't output relevant mysql information to clicked link using SELECT *FROM table WHERE variable LIKE '$variable'

蹲街弑〆低调 提交于 2019-12-25 18:45:20
问题 I have a mysql database named "drinks", in that database I have one table named "persons" and in "persons" I have two people, Bryan(fname) Fajardo(lname) 21(age) and Andross H Age:20. In my index.php I have links set up from all of the people in table persons. I am trying to get my links to work so that when I click on either name, the information relevant from that person is outputted into my other page (where the link goes to) which is: insert.php. I have been trying for hours to run some

Shell脚本之四 内建命令

匆匆过客 提交于 2019-12-25 18:12:52
所谓 Shell 内建命令,就是由 Bash 自身提供的命令,而不是文件系统中的某个可执行文件。 可以使用 type 来确定一个命令是否是内建命令: [root@localhost ~]# type cd cd is a Shell builtin [root@localhost ~]# type ifconfig ifconfig is /sbin/ifconfig 由此可见, cd 是一个 Shell 内建命令,而 ifconfig 是一个外部文件,它的位置是 /sbin/ifconfig 。 还记得系统变量 $PATH 吗? $PATH 变量包含的目录中几乎聚集了系统中绝大多数的可执行命令,它们都是外部命令。 通常来说,内建命令会比外部命令执行得更快,执行外部命令时不但会触发磁盘 I/O,还需要 fork 出一个单独的进程来执行,执行完成后再退出。而执行内建命令相当于调用当前 Shell 进程的一个函数。 接下来的几节我们将重点讲解几个常用的 Shell 内置命令。 一、Shell alias命令 使用 alias 命令自定义别名的语法格式为: alias new_name='command' 比如,一般的关机命令是 shutdown-h now ,写起来比较长,这时可以重新定义一个关机命令,以后就方便多了。 alias myShutdown='shutdown -h now

php基本语法形式

我怕爱的太早我们不能终老 提交于 2019-12-25 14:21:23
站长新闻 : 备注:目前有很多人通过李书记博客找到我,请教各种关于问题,而我这段时间是比较忙的,有时候真的是有心无力,网站更新也少了,希望大家见谅!还有很多phper希望我找下关于php相关的技术文档我现在争取每天更新一篇出来,希望大家满意! php的标记符有以下形式:形式1(推荐): <?php 这里要写符合php语法的语句 ?> 形式2: < language=”php”> 这里要写符合php语法的语句 </> 形式3(不推荐): <? 这里要写符合php语法的语句 ?> 它依赖于php.ini中的一个设置项: Short_open_tag = off 将其改为On,则上述形式就可以用了。 Short_open_tag = on php的结束标记(比如 ?> ),在如下情况可以省略: php的语句之后,再没有了html代码部分 php的区分大小写特性 1,变量区分大小写; 2,常量通常默认也区分,但可以人为设定为不区分(但这种做法不推荐) 3,其他场合的关键字都不区分,比如函数名,系统关键字(for,if,return….) 一条语句使用一个分号结束1, 在一个php的语句标记中的最后一个分号可省略 <?Php echo “<br/>abc11”; //逗号不能省略 echo “<br/>abc12”; echo “<br/>abc13” //可以省略 ?> 2,

How to escape two bash variables when echoing them

隐身守侯 提交于 2019-12-25 12:47:24
问题 I want to echo a text like this: "I'm going to bed at "$'\cc3'"$var"$'\cc' Sometimes it happens that the $var variable begins with a number and Bash is simply concatenating it or whatever. How could I escape the $var so it is separated but without a space between them? 回答1: The ANSI-C Quoting mechanism in Bash uses \cx to generate Control-X . Your use of $'\cc3' generates a Control-C (aka \003 or \x03 ) character followed by a digit 3. Superficially, then, you want: var=01:15 echo "I'm going

Echo: Argument List too long

喜欢而已 提交于 2019-12-25 07:39:57
问题 I'm running into an issue where my argument list for echo is too long and would like some ideas on how to get around this issue, or at least test for the condition so I can properly handle it, and it won't kill my script for file in `cat filelist`; do PROTOCOLS1=`egrep -i 'rsh|rsync|remsh' "$file" | egrep -v '^[ | ]*#'` FIELDS=`echo $PROTOCOLS1|wc -l` if [[ $FIELDS -gt 1024 ]]; then echo $file >> $debuglog else set -A myarray $PROTOCOLS1 do stuff..... fi done So the problem is that when my

How to sort by date using PHP opendir()

↘锁芯ラ 提交于 2019-12-25 07:36:58
问题 I have a directory full of files that I am trying to echo out. If the file is an image, the image itself is echoed out. If the file is not an image, the name of the file is echoed out. This code below works perfectly however I can't seem to get the order sorted by date. The files are randomly echoed out. How would I make it so that the files are sorted by last modified (latest first). <?php $blacklist = array("index.php"); $ext = pathinfo($files, PATHINFO_EXTENSION); if ($handle = opendir('.'