spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
  Home » SHELL » Page 1
What hanppened when I send a SIGCONT signal to a background job?
You can freeze a process by sending it a SIGSTOP and let it continue to run by sending SIGCONT. If you are writing your own shell, sending the process to the foreground or in the background is up to you. In bash sending SIGCONT lets the process continue in the background and you need to issue fg to put to the foreground.

Categories : Shell

ipython shell comands error
It's strange that !ls works on windows. The ! transmits the commands verbatim to the underlying operation system. Therefore, !ls shouldn't work on windows. ls on the other hand is implemented in IPython and thus should work. Even though this does not really answer your question. Why don't you simply use a pythonic way to achieve the same? You could use: files = sorted(filter(lambda x:'edges' in

Categories : Shell

Arithmetic operation from a file using cat
Can I assume that you've created weird artificial requirements? The file in its current form isn't usable... If you had c=$(($a+$b)) in the file, you could simply source it: . ./file echo $c # 47 You could also have a script that expects two arguments, echo $(($1+$2)), and you could use it like this: c=$(./file $a $b)

Categories : Shell

shell script to add a new column at last
You can just use this awk: awk 'BEGIN { OFS = "," } {print $0, "z"}' input.csv > output.csv Or even simpler to use sed: sed 's/$/,z/' input.csv > output.csv

Categories : Shell

Unix Shell sed - don't print last pattern
This awk may do: awk '/Keyword #1/ {f=1} /Keyword #2/ {f=0} f' file Keyword #1 animal rainbow train Keyword #1 female lawyer monkey rainbow It will use a start keyword and a stop keyword.

Categories : Shell

how to write linux shell script to execute set of cli commands on remote machine begining from cli
Put all the commands in a shell script on the remote vsphere machine, in say /usr/local/bin/commands like this: #!/bin/bash export PATH=something configure set module element ... set Module Element TenantInstance 1 ... Then make the script executable, like this: chmod +x /usr/local/bin/commands Then run it locally on the vspehere machine using this command till it all works: /usr/local/bin/

Categories : Shell

Timeout in shellscript
Use this for example: command & # start a new process in background pid=$(pidof command | cut -f1 -d' ') # save pid of started process sleep(timeout_value) # set timeout value to match your desired time to process pids=$(pidof command) # get all pids of running processes of this command if [[ $(grep "$pid" "$pids") ]]; then # if started process still running echo "error" el

Categories : Shell

Suppressing console output an errors while running Shell Script
You could wrap the entire thing in parantheses and do a 2>/dev/null ( ... script ... ) 2>/dev/null -That will run the script / snippet in a subshell. See this page for more info on redirecting.

Categories : Shell

how to make tcsh shell title show full path of current directory?
> cd /etc/defaults > set prompt = "%n@ %/ % " user@/etc/defaults % tmuxis more complicated since the pane status does not refresh on events unless you configure it to do so. See Auto-update tmux status bar with active pane pwd for tips on how to tackle this task.

Categories : Shell

sqlplus in silent mode doesn't work
The correct format is: sqlplus -S LOGIN_INFO @SCRIPT_TO_RUN The "silent" mode doesn't prevent terminal output. All it does is: -S Sets silent mode which suppresses the display of the SQL*Plus banner, prompts, and echoing of commands. If you want to suppress all terminal output, then you'll need to do something like: sqlplus ... > /dev/null 2>&

Categories : Shell

While loop breaks in bash script if i call Vimdiff within loop
Redirect so that vimdiff doesn't eat the input intended for the loop: while read line do vimdiff -c TOhtml -c wqa! $line"_file1" $line"_file2" < /dev/null done < inpFile.txt

Categories : Shell

Ansible set_fact doesn't change the variable value
Command line variables have the highest precedence of all variable types. Anything you define on the command line will override any other definitions of that variable. Documentation on variable precedence in Ansible is here http://docs.ansible.com/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable That lists all the other places you could put your initial/default value.

Categories : Shell

How to pass macro definition which generating from ShellScripts to source code in Android.mk
you need to recompile your lib so the function implementation can be updated. However, if there are no changes in the source file where GetGitVersion() is defined, it may not be recompiled. To force a recompilation of your sourcefile, you can use touch source.c (linux/unix) or copy /b source.c +,, (windows) to update your file last modification time.

Categories : Shell

shell script as an input parameter to pig in Oozie?
There used to be shell actions in oozie but not anymore. I'd recommend to create a Java action (http://oozie.apache.org/docs/4.0.0/WorkflowFunctionalSpec.html#a3.2.7_Java_Action) You can then get the output in oozie context with <capture-output /> and pass it to the pig script.

Categories : Shell

Awk command print max min values from log
You need to add two more array variables to keep track of the min and max. While you are at it, get rid of the grep | awk antipattern. awk -F'|' 'BEGIN { OFS="," } /EXSTAT|/ && /|F|/ { a[$11]++; c[$11] += $14; if (!($11 in max)) max[$11]=min[$11]=$14; if($14 > max[$11]) max[$11]=$14; if($14 < min[$11]) min[$11]=$14; } END { for(b in a) print b, a[b], c[b]/a

Categories : Shell

Scripting error unexpected token
!/bin/sh echo "find?" read find if [ -z find ]; then echo "Ok" fi if [ ! -z $find ]; then echo " You are in $(pwd)" echo " I'm searching " for element in $(ls) do echo $element if [ -d $ element ]; then echo $element "exist and is not empty" fi done fi #should close after for loop

Categories : Shell

How to remove empty directories after tar?
You have a typo in your sed call: sed -e '@/$@ d' -e 's/@^/@@' list.txt > list2.txt You were missing the / after the s in the -e s... expression. Without this fix, list2.txt will be empty.

Categories : Shell

grep for a specific pattern in a file?
The following selects lines that have at least one underline character followed by letters before the at-sign and one or more letters followed by at least one literal period after the at-sign: $ grep '_[a-z]+@[a-z]+.' textFile.txt abc_efg@qwe.asd afd_wer_asd@qweasd.zxcasd wqe_a@qwea.cae Notes An unescaped period matches any character. If you want to match a literal period, it must be escaped

Categories : Shell

How to get PID of started process in csh (not bash!)
Use % pidof command, or % ps. Example usage: $ csh % sleep 420 & [1] 28147 % pidof sleep 28147 % sleep 250 & [2] 28154 % pidof sleep 28154 28141 % ps PID TTY TIME CMD 28059 pts/5 00:00:00 bash 28146 pts/5 00:00:00 csh 28147 pts/5 00:00:00 sleep 28154 pts/5 00:00:00 sleep 28157 pts/5 00:00:00 ps You can easily pipe the output of the ps command to get the line and

Categories : Shell

Using ! operator on a shell command
Just add it in front of your condition to make it evaluate on the contrary: if ! grep -qi "sms" $FILE; then echo "yes"; fi ^ Test $ cat a hello bye $ if ! grep -qi "sms" a; then echo "sms not found"; fi sms not found

Categories : Shell

compile stylus sheets to a single file
You can import all the features in one file (main.styl) and watch only it (stylus -w main.styl), isn't it? Any changes to these files will be detected by Stylus and main.styl file will be recompiled as well. There is a reason why you don't do it this way?

Categories : Shell

[Shell Script]Fast way to read line by line of file
I know it isn't true answer about my problem, but I think I still use cat, and use parser in my client side coding. Since my data each line is simple and easy to parser. Thanks everyone for helping! And I hope it helps others, too!

Categories : Shell

Is trap EXIT required to execute in case of SIGINT or SIGTERM received?
The EXIT trap isn't working the same way in every shell. A few examples: In dash and zsh it's only triggered by a regular exit from within the script. In zsh, if you trap a signal that would normally quit the execution, you need to restore the default behaviour by explicitly calling exit. I'd suggest you to actually catch the signals and then exit, it should be portable across most shells: $

Categories : Shell

Maven command need to skip download dependencies
maven would only download dependencies if they are not in the local repository. when running on your local pc the local repository is in your pc (in windows in the user home .m2 directory). so either that directory gets deleted OR you changed the version of the dependencies OR you are using SNAPSHOT versions which means it is always trying to get the latest version from remote repository and thats

Categories : Shell

store output of ls - lrt in two different variables
This may not answer your question. To get all the files with yesterday's date: yesterday=$( date -d yesterday +%Y%m%d ) files=( "$yesterday"_* ) It's generally advised to avoid parsing the output of ls.

Categories : Shell

grep for a line with a specific words
Using grep -P and lookahead regex since your keywords can appear in any order: grep -iP '(?=.*?batman)(?=.*?city)(?=.*?gotham)' file Batman lives in Gotham City. In Gotham city batman is a vigilante Batman and Joker live in Gotham city. Or using awk: awk '/[bB]atman/&&/[cC]ity/&&/[gG]otham/' file Batman lives in Gotham City. In Gotham city batman is a vigilante Batman and

Categories : Shell


Recently Add
Guake terminal startup shell script
What hanppened when I send a SIGCONT signal to a background job?
ipython shell comands error
Arithmetic operation from a file using cat
shell script to add a new column at last
Unix Shell sed - don't print last pattern
how to write linux shell script to execute set of cli commands on remote machine begining from cli
Timeout in shellscript
Suppressing console output an errors while running Shell Script
how to make tcsh shell title show full path of current directory?
sqlplus in silent mode doesn't work
While loop breaks in bash script if i call Vimdiff within loop
Ansible set_fact doesn't change the variable value
How to pass macro definition which generating from ShellScripts to source code in Android.mk
shell script as an input parameter to pig in Oozie?
Awk command print max min values from log
Scripting error unexpected token
How to remove empty directories after tar?
grep for a specific pattern in a file?
How to get PID of started process in csh (not bash!)
Using ! operator on a shell command
compile stylus sheets to a single file
[Shell Script]Fast way to read line by line of file
Is trap EXIT required to execute in case of SIGINT or SIGTERM received?
Maven command need to skip download dependencies
store output of ls - lrt in two different variables
grep for a line with a specific words
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.