logo
down
shadow

SHELL QUESTIONS

I moved few scripting files from one location to another. I didn't mention names to those files in the destination
I moved few scripting files from one location to another. I didn't mention names to those files in the destination
I hope this helps . If I have a file myfile in folder A (so, A/myfile), and I want to move that file into a folder B inside of folder A (so, into A/B/), I need to use mv myfile B. That will result in there being a file A/B/myfile.What you ran was the
TAG : shell
Date : January 12 2021, 01:40 AM , By : dummyadresse
Why can't values set in a cat | while loop be read after the loop?
Why can't values set in a cat | while loop be read after the loop?
will be helpful for those in need cat is redundant and is the cause to your problem because the "|" pipe creates a subshell. That's why when you go out of the while loop, the value of $b is "lost". just redirect the file to while read loop
TAG : shell
Date : January 10 2021, 01:57 PM , By : Stephen Dewar
How to make conditional expansion without subshell?
How to make conditional expansion without subshell?
To fix this issue I wrote following function in GNU Make, that checks whether first argument belongs is found in some list, and expands to second or third argument accordingly: , I'm not sure I fully understand but why not this?
TAG : shell
Date : January 06 2021, 03:17 PM , By : Martin
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 : January 02 2021, 06:48 AM , By : Debashree
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 : January 02 2021, 06:48 AM , By : Nickolas
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 : January 02 2021, 06:48 AM , By : appdelivery
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 : January 02 2021, 06:48 AM , By : kuba53280
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 : January 02 2021, 06:48 AM , By : vitorcoliveira
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 : January 02 2021, 06:48 AM , By : Bo.
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 : January 02 2021, 06:48 AM , By : jrf
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 : January 02 2021, 06:48 AM , By : obijywk
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 : January 02 2021, 06:48 AM , By : Tink
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 : January 02 2021, 06:48 AM , By : John Q.
Cheat sheet exhibiting bash shell stdout/stderr redirection behavior
Cheat sheet exhibiting bash shell stdout/stderr redirection behavior
around this issue http://wiki.linuxquestions.org/wiki/Bash-operators
TAG : shell
Date : January 02 2021, 06:48 AM , By : paolodm
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 : January 02 2021, 06:48 AM , By : yarry
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 : January 02 2021, 06:48 AM , By : lhoBas
How to add space for 4th field in a file with unix shell script
How to add space for 4th field in a file with unix shell script
this one helps. Need to check in a file for 4th field with length 9 if the length is 9 I need to pad a space in that 4th field and make it as 10 , You can use the following awk command:
TAG : shell
Date : January 02 2021, 05:18 AM , By : Vrki
fish shell seems to be ignoring LD_LIBRARY_PATH?
fish shell seems to be ignoring LD_LIBRARY_PATH?
hope this fix your issue I need to set LD_LIBRARY_PATH for CUDA prior to launching darknet. Looks like this: , You’re not exporting your variable. Instead, do:
TAG : shell
Date : January 01 2021, 05:04 PM , By : Paul McKee
How to provide option or arguments as suggestions to my custom command in unix shell
How to provide option or arguments as suggestions to my custom command in unix shell
it should still fix some issue The features is called "autocomplete" (or similar) and there are many resources available on the internet on how to implement it in bash, for example this etc.From what I get from your post, assuming your subdirectories
TAG : shell
Date : December 31 2020, 03:06 AM , By : usingtechnology
How to add a semi-colon ; after each create ddl statement using shell scripts
How to add a semi-colon ; after each create ddl statement using shell scripts
I hope this helps you . I'd take the easy way and make use of the possibilities that the ; doesn't have to be on the same line as the (end of the) statement and that there may be an empty statement. This gives:
TAG : shell
Date : December 28 2020, 02:06 PM , By : barefootChild
unable to iterate through all the elements in the for loop
unable to iterate through all the elements in the for loop
will be helpful for those in need I do not have servers to test on so let me strip the content of the second for loop.Problem is here machine_new_ip="$(echo ${machine_info}|cut -d, -f2)"
TAG : shell
Date : December 27 2020, 02:58 PM , By : MK.
Create a file from Shell script Variable
Create a file from Shell script Variable
should help you out I am trying to create a file from a shell script variable (.sh file ext) , Resolution:
TAG : shell
Date : December 25 2020, 05:02 PM , By : Ben Kohn
Find and tar files which are X hours old
Find and tar files which are X hours old
it fixes the issue Use:-mmin n to filter for files that were modified n minutes ago.
TAG : shell
Date : December 25 2020, 04:01 PM , By : Sandip
fish shell command subsitution in watch command
fish shell command subsitution in watch command
should help you out I'm trying to use the watch command in the fish shell. , In short:
TAG : shell
Date : December 25 2020, 09:33 AM , By : lwl_seu
i can't cache:clear because var/cache/dev/profiler is used by www-data
i can't cache:clear because var/cache/dev/profiler is used by www-data
wish help you to fix your issue You don't need to run crontab as root at all. Make sure that 'user' belongs to the www-data group and create a cron job for that user:
TAG : shell
Date : December 25 2020, 09:01 AM , By : CrimsonGore
Spark-submit is not working which is there in shell script submitted thru Oozie workflow
Spark-submit is not working which is there in shell script submitted thru Oozie workflow
hop of those help? The reason it's failing is that a shell action will run on an arbitrary node in your cluster, and those nodes do not have spark-submit installed on them (hence the "No such file or directory" error).You have two options:
TAG : shell
Date : December 25 2020, 08:30 AM , By : harley.holt
How to use expect in Shell script like nested If Else loop?
How to use expect in Shell script like nested If Else loop?
may help you . First, you're missing the Command Substitution syntax to execute the expect code:
TAG : shell
Date : December 25 2020, 07:30 AM , By : negonicrac
Awk get specific word between special characters
Awk get specific word between special characters
hope this fix your issue I need some help. I have this info.txt , This works:
TAG : shell
Date : December 25 2020, 06:45 AM , By : quicky
Pipe multiple commands in find --exec
Pipe multiple commands in find --exec
like below fixes the issue exec runs a single command with its arguments, not an arbitrary shell command. To do that, you need to explicitly run a shell.
TAG : shell
Date : December 24 2020, 10:01 PM , By : Aki Björklund
How can I remove digits from these strings?
How can I remove digits from these strings?
Hope that helps I have a text file containing a few string values:
TAG : shell
Date : December 24 2020, 06:30 PM , By : Tony Z
SHELL : awk trim/replace
SHELL : awk trim/replace
Hope this helps I need some help. I have this info.txt , With GNU awk could you please try.
TAG : shell
Date : December 24 2020, 11:30 AM , By : Erwin
Why it does awk give me a fatal error : I/O?
Why it does awk give me a fatal error : I/O?
Any of those help I am trying to execute below code in my script. It is a small part of my code which is throwing an I/O error after successfully executing my script. , Are you sure that
TAG : shell
Date : December 23 2020, 05:01 PM , By : Piotr Balas
Passing script files on hdfs to impala-shell
Passing script files on hdfs to impala-shell
I wish this help you Impala shell can accept query text from STDIN. As described here, option -f
TAG : shell
Date : December 23 2020, 02:30 PM , By : Tim
what is the time about nohup command execute in shell?
what is the time about nohup command execute in shell?
it helps some times It's because you put the nohup command in the background with . There is no output immediately from the command when you put it in the background as it is running in a separate shell, and your current shell immediately goes to the
TAG : shell
Date : December 23 2020, 02:01 PM , By : ugufugu
Shell : Explode and Save file
Shell : Explode and Save file
I wish did fix the issue. You need to allow whitespaces before and after END as delimiter to get rid of new lines and also have a call to sub function to discard first line from output. You may use this command
TAG : shell
Date : December 23 2020, 09:01 AM , By : barefootChild
How to write output terminal with tab to the file in shell?
How to write output terminal with tab to the file in shell?
this one helps. I have an executable file that provides a float random number that displays in the terminal such as , You can use printf:
TAG : shell
Date : December 23 2020, 02:30 AM , By : Sascha Brossmann
DDD/CQRS/ES How to model a shell command in the domain layer?
DDD/CQRS/ES How to model a shell command in the domain layer?
wish of those help Does the Patch AR can provides a method relying on a domain service
TAG : shell
Date : December 22 2020, 09:30 AM , By : harley.holt
Weird txt behavior
Weird txt behavior
I hope this helps you . The text file has no newline character at the end of it. Some programs will treat it as a valid text file whose last line doesn't happen to end in a newline. Others (apparently including bash's built-in read command, at least
TAG : shell
Date : December 22 2020, 07:30 AM , By : picamiolo
Find average of numbers of specific cloumns
Find average of numbers of specific cloumns
I hope this helps you . You were thinking correctly to store the values in arrays, but here it is easier to read all values into arrays using $1 as the key to sum each of $2 and $3 into separate arrays as the records are read keeping at count of the
TAG : shell
Date : December 20 2020, 04:46 AM , By : artifex
How to run commands while logging from one machine to another using Expect
How to run commands while logging from one machine to another using Expect
I think the issue was by ths following , You want to run the second ssh within the connection you already opened to machine m1, so you don't need a second spawn as this will try to open a new connection from your local machine. So instead of the seco
TAG : shell
Date : December 17 2020, 07:28 AM , By : Ron
How to run/call a shell script function with graphicsmagick
How to run/call a shell script function with graphicsmagick
it fixes the issue You should be able to do it all in one like this, without Ubuntu or shell scripts, just in Command Prompt:
TAG : shell
Date : December 16 2020, 02:56 PM , By : user152423
use shell pipe output as calculator input
use shell pipe output as calculator input
it should still fix some issue As mentioned by Charles that parsing ls is not a good practice but anyway if you want to do that, you can try
TAG : shell
Date : December 05 2020, 12:26 PM , By : Martin Kopp
How to substitute values in a key-value file if keys exists in shell environment?
How to substitute values in a key-value file if keys exists in shell environment?
this one helps. I have a file like below with key value pair separated by =. I have already exported some variables to my shell. Now I want a shell script which can substitute the values for its corresponding keys if those keys are already exist in e
TAG : shell
Date : December 05 2020, 12:18 PM , By : user182548
Unexpected operator in if statement
Unexpected operator in if statement
hop of those help? The script you’ve posted has various issues, which are highlighted by ShellCheck:
TAG : shell
Date : December 05 2020, 12:10 PM , By : ack
shell - How to match content between xml tags?
shell - How to match content between xml tags?
With these it helps If you have PCRE capable grep you could use positive lookahead and -behind:
TAG : shell
Date : December 05 2020, 12:04 PM , By : John Phipps
How to use shell script code in a Perl script
How to use shell script code in a Perl script
this one helps. I want to convert a shell script code in Perl and use exec to execute the code. I have program written in perl but on a condition i have to add a code which i know how we can do in shell script but not sure how we can do in perl. , A
TAG : shell
Date : December 05 2020, 11:52 AM , By : Tony Z
Run a script from inside a shell script
Run a script from inside a shell script
wish helps you Fixed. Just added '' between the two commands and put them in one line. So, hello.sh looks like -
TAG : shell
Date : December 01 2020, 04:42 PM , By : user121501
Error while executing sed command
Error while executing sed command
Hope this helps The general syntax of a sed script is a sequence of address command arguments statements (separated by newline or semicolon). The most common command is the s substitution command, with an empty address, so we can perhaps assume that
TAG : shell
Date : November 29 2020, 09:01 AM , By : beebob
Finding frequency of each item in a column using shell
Finding frequency of each item in a column using shell
should help you out I'm quite inexperienced with shell/ mac terminal so any help or advice would be greatly appreciated.
TAG : shell
Date : November 27 2020, 03:01 PM , By : user157654
Organization of commands in makefile
Organization of commands in makefile
around this issue Before worrying about make you should ensure that you can run the commands correctly from the shell prompt. In this case you're misunderstanding how the background token works; it applies to the entire previous section of the comma
TAG : shell
Date : November 27 2020, 12:01 PM , By : Lucas Thompson
What is the POSIX defined behavior of <> when used in a redirect?
What is the POSIX defined behavior of <> when used in a redirect?
it fixes the issue From the 2017 IEEE standards for "Shell Command Language":
TAG : shell
Date : November 26 2020, 12:01 PM , By : firebasket
When running an ansible playbook via a shell script in Jenkins pipeline, the echo output is buffered and does not show i
When running an ansible playbook via a shell script in Jenkins pipeline, the echo output is buffered and does not show i
may help you . I think what you want is already the default behavior of sh, but you have disabled it by using returnStdout: true. This causes the output to be captured and returned, instead of printed. Then you print it with echo.From the documentati
TAG : shell
Date : November 26 2020, 12:01 PM , By : KS9
Shell scripting removing negative integer
Shell scripting removing negative integer
will help you You can treat the value as a string or as a number, as you wish. If you treat it as a string, you don't have to do numeric operations:
TAG : shell
Date : November 25 2020, 07:22 PM , By : Dominique Vocat
Elastic Beanstalk cron and deployment permissions
Elastic Beanstalk cron and deployment permissions
wish of those help During deployment to AWS Elastic Beanstalk I want to do two things:
TAG : shell
Date : November 25 2020, 07:22 PM , By : user183526
sml configuration on ubuntu, how to run sml on command instead of the full path?
sml configuration on ubuntu, how to run sml on command instead of the full path?
To fix the issue you can do Well, either add /usr/share/smlnj/bin to your PATH env variable, or make a symlink to the command in a standard folder like /usr/bin, or write a small wrapper script which would also allow you to make additional adjustment
TAG : shell
Date : November 25 2020, 07:22 PM , By : amy
To ignore Pipe in pipe delimited file
To ignore Pipe in pipe delimited file
it should still fix some issue With GNU awk you would need to use FPAT to describe what a field is instead of using FS to describe what the field separator is. For example:
TAG : shell
Date : November 25 2020, 07:06 PM , By : Ambarish Singh
Split a file containing rows of CSV into several files in shell or Sheets
Split a file containing rows of CSV into several files in shell or Sheets
help you fix your problem I think, you can do it as follows with using cat and piping appropriate combinations of head and tail commands:
TAG : shell
Date : November 25 2020, 12:01 PM , By : user182548
getting error /usr/bin/env: sh: No such file or directory when running command play
getting error /usr/bin/env: sh: No such file or directory when running command play
I hope this helps you . This error usually happens if the script has windows line endings instead of unix line endings.Try running dos2unix on the script and try running your command again to see if you get the same error.
TAG : shell
Date : November 25 2020, 01:01 AM , By : Justin Bowers
awk: assigning a shell variable in awk script
awk: assigning a shell variable in awk script
will help you One way: Use the redirection inside your awk command and print your result in the END block. And use command substitution to read the result in a shell variable:
TAG : shell
Date : November 24 2020, 03:41 PM , By : mgz
Calculating a to power b (a^b) in shell script
Calculating a to power b (a^b) in shell script
I hope this helps you . I am new to shell scripting. I was doing some math problem in shell script, i found almost all the calculations involving math except a to power b (a^b). , bc is part of POSIX:
TAG : shell
Date : November 24 2020, 03:41 PM , By : geo

shadow
Privacy Policy - Terms - Contact Us © scrbit.com