sh
How do I limit the number of results returned from grep?
I would like开发者_如何学C to say 10 lines max from grep. I don\'t want my computer to work hard. I want it to stop after 10 results found by grep. Is it possible?The -m option is probably what you\'[详细]
2023-02-10 14:21 分类:问答Inline if shell script
Is it possible to execute shell script in command line like this : counter=`ps -ef | grep -c \"myApplication\"`; if [ $counter -eq 1 ] then; echo \"true\";[详细]
2023-02-10 10:22 分类:问答Using variables inside a bash heredoc
I\'m trying to interpolate variables inside of a bash heredoc: var=$1 sudo tee \"/path/to/outfile\" > /dev/null << \"EOF\"[详细]
2023-02-09 02:55 分类:问答Can someone tell me why this shell script isn't working the way I want it to
ssh hostname ps aux| egrep \'.*python\' |开发者_如何学C grep -v \'grep\'| awk \'{print $2}\'| xargs kill -KILL[详细]
2023-02-09 00:03 分类:问答Display octal value without being interpreted with tr?
I have ./script \"test\\42\" Here is an example script : #!/bin/sh echo \"$1\" It gives me : test\" (42 being interpreted as an ASCII octal value, 42 = \")[详细]
2023-02-07 21:36 分类:问答unix map function
I have an array of values $dates that I\'m transforming: for i in $dates do date -d \"1970-01-01 $i sec UTC\" \'+%a_%D\'[详细]
2023-02-06 07:14 分类:问答Bourne/POSIX shell parameter splitting
Assume I have some utility that can take a number of options, each followed by a filename. E.g., I could call it as myutil, myutil -o somefile, myutil -p anotherfile, myutil -o somefile -p anotherfile[详细]
2023-02-06 05:09 分类:问答Replacement for source in sh
I need to set the environment variables,usually we do this by source script.sh But now, I am automating it duri开发者_运维问答ng the boot process and it looks like the root boots by default with sh[详细]
2023-02-06 00:02 分类:问答Bash script: Tar not working properly
I\'ve just put together the below shown bash script in order to make continuous backups from a set folder.[详细]
2023-02-05 19:24 分类:问答Need a shell script that deletes all files except *.pdf
Can anyone write a shell script that deletes all the file开发者_Go百科s in the folder except those with pdf extension?This will include all subdirectories:[详细]
2023-02-04 18:02 分类:问答