logo
down
shadow

SHELL QUESTIONS

Syntax error: "then" unexpected (expecting "done")
Syntax error: "then" unexpected (expecting "done")
this one helps. Don't forget, in shell [ is a binary that take parameters and return true or false (0 or 1).if is a keyword that verifies the return of next binary called is true (0).
TAG : shell
Date : November 16 2020, 07:01 PM , By : Juraj Konfal
GnuPG Shell Script - Refuses to read password
GnuPG Shell Script - Refuses to read password
Any of those help The script below used to work on Mac OS X, but, since moving it to Ubuntu, it doesn't seem to read from the password file at all. Even when I run it from the command line, no matter what I do, I get a popup prompt asking me for the
TAG : shell
Date : November 14 2020, 07:01 PM , By : Emmad Hussain
Dispose of SWT shell when cursor moves out of it
Dispose of SWT shell when cursor moves out of it
This might help you Attach a MouseTrackListener with MouseTrackAdapter as a listener and override mouseExit() method.
TAG : shell
Date : October 28 2020, 04:55 PM , By : user3853972
My nestedif on unix shell scripting using sh has a syntax error and i can't seem to fix it
My nestedif on unix shell scripting using sh has a syntax error and i can't seem to fix it
With these it helps I'm coding a nestedif program as shown below but there is a syntax error that says "Syntax error: "then" unexpected (expecting "fi") , Replace:
TAG : shell
Date : October 23 2020, 06:10 AM , By : Mithlesh Kumar
Convert hex to dec using awk
Convert hex to dec using awk
this will help With GNU awk for strtonum() you don't need to spawn multiple shells on each input line:
TAG : shell
Date : October 14 2020, 01:00 PM , By : Vic
remember a match in some previous line and print it just once and only if a consecutive line contains some match with se
remember a match in some previous line and print it just once and only if a consecutive line contains some match with se
I hope this helps . sed magic wanted: , Could you please try following once.
TAG : shell
Date : October 13 2020, 06:00 PM , By : Leonardo Rezende
Catching STDOUT and STDERR with pipes on next command as separated arguments?
Catching STDOUT and STDERR with pipes on next command as separated arguments?
may help you . Is it possible to have a command to catch both STDOUT and STDERR as separated streams to use as arguments in the next command? , You can do this with the help of named pipes:
TAG : shell
Date : October 11 2020, 02:00 PM , By : JWBlanch
How to associate filename with user defined functions in makefile
How to associate filename with user defined functions in makefile
I wish this help you I have a makefile which is huge and pretty complex. So I wanted to split that up. While splitting up I have come through an interesting problem. , You cannot do anything even remotely like this:
TAG : shell
Date : October 11 2020, 11:00 AM , By : Denis D
Why is if [ $? -eq 0 ] an antipattern?
Why is if [ $? -eq 0 ] an antipattern?
it fixes the issue Shell scripts are often written by people who are not very familiar with the language. This makes for a lot of copy/paste code, even in scripts which would nominally have received a fair amount of review, scrutiny, and field testin
TAG : shell
Date : October 11 2020, 08:00 AM , By : MrĐặng Đăng Khoa
if else with number comparison in shell script
if else with number comparison in shell script
this will help I have this code : , Syntax issues aside, this is what you're doing:
TAG : shell
Date : October 10 2020, 10:00 PM , By : Balram Pandey
Is there any way to convert paragraphs to columns in shell script to format it in Excel?
Is there any way to convert paragraphs to columns in shell script to format it in Excel?
hope this fix your issue We have a requirement to format data, given in list format, into a CSV file , It is easily done with awk,
TAG : shell
Date : October 10 2020, 09:00 PM , By : Trinh Thi Dao
How to use shell command in GNU Make to echo string
How to use shell command in GNU Make to echo string
like below fixes the issue I have the following lines in my makefile: , The problem is the use of $(shell ...). What you want is:
TAG : shell
Date : October 10 2020, 04:00 PM , By : Peter Jancar
convert the shell output to float64?
convert the shell output to float64?
I wish did fix the issue. The conversion fails probably because there is some whitespace or newline character on s1. Try to trim it first before doing the conversion. Use strings.TrimSpace() to achieve that.
TAG : shell
Date : October 09 2020, 07:00 AM , By : Davide Pacifico
I need to replace literal \n with newline in shell
I need to replace literal \n with newline in shell
I think the issue was by ths following , You are facing the problem because you are using OSX or BSD probably. With GNU sed, 's/\\n/\n/g’ should have worked.For POSIX sed, use this,
TAG : shell
Date : October 08 2020, 11:00 AM , By : Bruno
How to create a unix script to loop a Hive SELECT query by taking table names as input from a file?
How to create a unix script to loop a Hive SELECT query by taking table names as input from a file?
it should still fix some issue It's pretty straightforward what I'm trying to do. I just need to count the records in multiple Hive tables. , Simple working shell script:
TAG : shell
Date : October 08 2020, 01:00 AM , By : Sear Cheulong
Why is it much slower to use cut than awk to intercept two strings from each line in a file?
Why is it much slower to use cut than awk to intercept two strings from each line in a file?
it should still fix some issue As @zerkms has called out, the performance difference here is determined much more by the efficiency of the algorithms as opposed to the text processing command in play.To understand the differences between the two, you
TAG : shell
Date : October 07 2020, 06:00 PM , By : Alan
How to portably implement `test path1 -ef path2`?
How to portably implement `test path1 -ef path2`?
it helps some times Believe it or not, I think ls is your best bet; the -i option is defined to output the serial number prior to the file name.
TAG : shell
Date : October 07 2020, 11:00 AM , By : Thiiil
how to get minimum prefix from a large file
how to get minimum prefix from a large file
This might help you I have a big file whose entries are like this . Input: , You may use this awk command:
TAG : shell
Date : October 06 2020, 10:00 PM , By : David
AWK: Read a File "x" and compare it's values against the value of Column 1 and column 2 of file "y"
AWK: Read a File "x" and compare it's values against the value of Column 1 and column 2 of file "y"
Does that help Your posted expected output doesn't match the description of what you want to do so idk if this is right or not but this does what I think you described:
TAG : shell
Date : October 06 2020, 09:00 AM , By : Bandi
perl encode_base64 versus Redhat base64 command
perl encode_base64 versus Redhat base64 command
around this issue I can't seem to figure out why there is a difference: , It's the same as the difference between
TAG : shell
Date : October 06 2020, 04:00 AM , By : anoop jasola
Find all combinations of two-character letters/digits, similar to jot(1) for numbers
Find all combinations of two-character letters/digits, similar to jot(1) for numbers
wish of those help Combining the answers by jenesaisquoi and David C. Rankin, the shortest solution would appear to require bash (tcsh and OpenBSD's ksh don't support echo {0..9} expansion), and is as follows:
TAG : shell
Date : October 05 2020, 07:00 PM , By : Carlo Ang Jr
Command that is not found in Mac os Terminal
Command that is not found in Mac os Terminal
I wish this help you I am trying to install mySQL on macOS Mojave. I have installed mySQL Community Server 8.0.17 and then attempted to configure the command line to recognize mySQL commands by using the following code in Terminal: , The problem is i
TAG : shell
Date : October 05 2020, 12:00 PM , By : syed
Rename command not evaluating expressions
Rename command not evaluating expressions
this one helps. rename uses Perl Compatible Regular Expression for substitution, e.g. s/txt.*/txt/So, try this:
TAG : shell
Date : October 04 2020, 04:00 AM , By : Abeer
Stop and Remove Container does not work sometimes
Stop and Remove Container does not work sometimes
this one helps. Do you have by any chance any other process/user login to container sometimes when it did not stopped ? Since as you mentioned this is something not happening frequently : have you checked the state of environment when this happens fo
TAG : shell
Date : October 04 2020, 04:00 AM , By : tanu kamboj
Non delimited file on delimited file
Non delimited file on delimited file
I think the issue was by ths following , For the original data Judging from the data shown, the input file has three blanks between columns. Therefore, a sed script is appropriate:
TAG : shell
Date : October 03 2020, 11:00 PM , By : gravity
Using sed to delete all lines between two matching patterns including the matched lines
Using sed to delete all lines between two matching patterns including the matched lines
like below fixes the issue The following sed shoud remove all lines between object Host "kali" { and }.
TAG : shell
Date : October 03 2020, 05:00 AM , By : chouchen
Need uniq output for df -h and remove duliplicate values
Need uniq output for df -h and remove duliplicate values
To fix this issue A much more appropriate tool for this job is jq. Consider (note for folks testing this that the ABC|XYZ|RR regex should be changed to match at least one local mount point):
TAG : shell
Date : October 02 2020, 12:00 PM , By : Harrison Bennett
Filter timestamps in a stream of text for those within last 5 minutes
Filter timestamps in a stream of text for those within last 5 minutes
I wish this help you You could convert the date to MSB->LSB in order to compare: YYYYMMDDHHMMSSTo get the date 5 minutes ago:
TAG : shell
Date : October 02 2020, 11:00 AM , By : Andrs Serg Z ryzsy
Opening an erlang shell from bash
Opening an erlang shell from bash
This might help you You can use rebar3 - https://www.rebar3.org/, or Erlang.mk - https://erlang.mk/, or you can create your own Makefile for compile your modules, moved to some folders and run shell from folders where you have *.beam files after comp
TAG : shell
Date : October 01 2020, 09:00 PM , By : David Brickwood
How to escape $ in a echo command nested inside sed command
How to escape $ in a echo command nested inside sed command
will be helpful for those in need I have a recipe in makefile for preparing the repository, it converts all .sh files to be executables. , You escape dollar with a dollar inside make.
TAG : shell
Date : October 01 2020, 11:00 AM , By : albert
Problem in Makefile forloop break statement
Problem in Makefile forloop break statement
help you fix your problem In the posted code the 'for' loop is executed in the shell (bash ?), not by the 'make' utility.The problem with the bash script is that the 'break' statement is running in a sub-process - as it is placed inside parenthesis '
TAG : shell
Date : October 01 2020, 06:00 AM , By : Sourav
If I'm creating 10 compute instances through a script on GCP, will those instances get created sequentially or parallely
If I'm creating 10 compute instances through a script on GCP, will those instances get created sequentially or parallely
I wish this helpful for you The Google Cloud Console does not support shell scripts.If you mean that you are using the SDK CLI gcloud, you have the option --async to not wait for the API command to complete. Otherwise, the commands run one at a time.
TAG : shell
Date : September 29 2020, 10:00 PM , By : sijoy devasia
shell script not working for or condition with -z
shell script not working for or condition with -z
may help you . my file name test2.sh. , if i understood your question you can try in this way:
TAG : shell
Date : September 29 2020, 10:00 AM , By : w.acosta
What does pri/xit mean in autosys job summary?
What does pri/xit mean in autosys job summary?
Hope this helps The last column "Pri/Xit" represents the exit code returned by the script or a runtime error code by Autosys scheduler.Goodluck !!
TAG : shell
Date : September 29 2020, 08:00 AM , By : beefgoat
how to remove all files from hdfs location except one?
how to remove all files from hdfs location except one?
hop of those help? A best option would be to copy specific file to some other directory and delete all the remaining files in target directory and then move specific file to the same directory.Else, There are couple of other ways as well to do the sa
TAG : shell
Date : September 29 2020, 02:00 AM , By : Winging
Convert country code to country name from shell script
Convert country code to country name from shell script
I wish this helpful for you Assuming you have the mapping in a file, you can use bash associative arrays
TAG : shell
Date : September 27 2020, 01:00 PM , By : Juan Mendieta
How to optimize grep
How to optimize grep
Hope that helps A good implementation of tac should use fseek(... SEEK_END). With mix with grep -m1 should allows for quite a fast parsing the file from the end to the first matching string. With grep -P we can remove all the unneeded parsing and pro
TAG : shell
Date : September 27 2020, 08:00 AM , By : Haneef Khan
sed/awk unix csv file modification
sed/awk unix csv file modification
wish help you to fix your issue I have a directory that is receiving .csv files. , You may do it all with GNU awk:
TAG : shell
Date : September 27 2020, 02:00 AM , By : Hossin Maya
AWK case sensitive
AWK case sensitive
this will help My CSV file is like this >> , Could you please try following.
TAG : shell
Date : September 26 2020, 10:00 PM , By : DrakeKM
insert single and double inverted comma in between number and char value in shell
insert single and double inverted comma in between number and char value in shell
I wish did fix the issue. I have a data file like this , Hope this help. Multiple sed in one command.
TAG : shell
Date : September 25 2020, 05:00 PM , By : Edward
How to split stdout into stdout and stderr with grep?
How to split stdout into stdout and stderr with grep?
fixed the issue. Will look into that further You can use perl to match the pattern and write it to standard error stream by just prepending STDERR with print
TAG : shell
Date : September 25 2020, 02:00 PM , By : John Monroe
Generating random characters in a shell script
Generating random characters in a shell script
With these it helps One approach will be to remove items that have been selected from 'array', and check that new selection do not referenced removed items. It attempt to generalize the behavior of the OP code to - it loops over the number of request
TAG : shell
Date : September 25 2020, 01:00 PM , By : ERVE
Getting awk syntax error while running belwo script
Getting awk syntax error while running belwo script
With these it helps It's a bad idea to try passing anything that requires complex quoting (such as a multi-line shell script) as an option to ssh. You have embedded quotes (") in your script that will interact poorly with the quotes you've used to su
TAG : shell
Date : September 24 2020, 12:00 AM , By : sambireddy julakanti
Split the line including all words and special characters
Split the line including all words and special characters
Hope that helps You can use a regular expression that will match either a sequence of word characters, or a sequence of non-word characters:
TAG : shell
Date : September 22 2020, 06:00 PM , By : jhqq
Shell Script compare the values with input parameter
Shell Script compare the values with input parameter
like below fixes the issue The $ sign assigns the input argument, so we're getting first input if it matches the below variable, so do what you want inside if condition.
TAG : shell
Date : September 22 2020, 03:00 AM , By : Beryl Vincent
Use ShGetFolderPath in Delphi, which unit should I include?
Use ShGetFolderPath in Delphi, which unit should I include?
To fix the issue you can do SHGetFolderPath is deprecated and is supported only for backward compatibility.For new system and new application you can use SHGetKnownFolderPath instead.
TAG : shell
Date : September 22 2020, 12:00 AM , By : SUNEEL KAUSHIK S
How to use binary numbers in a shell script?
How to use binary numbers in a shell script?
wish of those help I don't think there is a POSIX shell syntax to define numbers in non-decimal (unless you use an external program such as bc to do the conversion for you):
TAG : shell
Date : September 20 2020, 11:00 PM , By : Danny Jozette Enriq
negative value problem in array in korn shell
negative value problem in array in korn shell
seems to work fine The problem is that ksh interprets anything starting with a dash as an option (at least for set), so it reads -0.143 as a series of options: 0, ., 1, 4, and 3.To get around this, you can use -- before any of the array elements to t
TAG : shell
Date : September 20 2020, 01:00 PM , By : senthil kumar
Find second-latest file when names can contain spaces
Find second-latest file when names can contain spaces
it should still fix some issue Below is my shell script. I need to fetch second latest file size. But when I am trying to run below script i am getting issue where ever space is there, it's trying to open it as a directory/file and giving error like
TAG : shell
Date : September 20 2020, 07:00 AM , By : EvoDark
Cummulative to individual using awk
Cummulative to individual using awk
will be helpful for those in need I have following datafile where the values are in cumulative to some point (until row1 > row2): , Here is another awk idea:
TAG : shell
Date : September 18 2020, 04:00 PM , By : baha adin
How to slow down tail'ing logs
How to slow down tail'ing logs
wish helps you Yes, but no.Tail isn't very useful here, you are probably better off using less +F or piping it into a file.
TAG : shell
Date : September 17 2020, 04:00 PM , By : Pete Todd
How to call shell script function in my Perl?
How to call shell script function in my Perl?
Hope this helps I have some functions in util.sh, I want to call function in util.sh and get the return value. Does anyone know how to do? , You could source the shell script into the subprocess by
TAG : shell
Date : September 10 2020, 02:00 AM , By : Mandla Mlotshwa
Implementation of timeout in perl
Implementation of timeout in perl
seems to work fine You don't time out the script which you have started; you set the alarm for the current (parent) script. You would have to kill the child process (the one you have started using system) from your alarm-sub.EDIT:
TAG : shell
Date : September 09 2020, 03:00 PM , By : Sana Fatima
shadow
Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk