Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Favorites infavorites:mine
infavorites:1234
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with Search options user 264385

The shell is Unix's command-line interface. You can type commands in a shell interactively, or write scripts to automate tasks. Use this tag for questions applying to /bin/sh and most compatible shells (ash, bash, ksh, zsh, …). For shell scripts with errors, please check them in http://shellcheck.net before posting here.

0
votes
3answers
Why does the following does not work? INTERNAL_NUM=$(grep -E '\s*internal_num\s*=' file.xml |sed -E 's/internal_num\s*=\s*([0-9]\+)/\1/') echo "$INTERNAL_NUM" I would like to print out the actual …
asked Mar 20 '18 by Jim
0
votes
1answer
I have a string that represents a kind of version. I would like to increment it and if the second part exceeds 9 to go to the next higher number The following seems to work. I was wondering if there …
asked Mar 28 '18 by Jim
1
vote
1answer
What exactly does the following do? MY_VAR=${MY_INPUT##*$'\n'}
asked Mar 21 '18 by Jim
7
votes
4answers
Is there a way to avoid doing grep two times in the file and just populate the variables in one pass? The file is small so it is not that a big deal I was just wondering if I could do it in one pass …
asked Mar 27 '18 by Jim
11
votes
4answers
I have a JSON fragment. The following does not work: VALUE=<<PERSON { "type": "account", "customer_id": "1234", "customer_email": "jim@gmail.com" } PERSON echo -n "$VALUE" | python -m json …
asked Apr 11 '18 by Jim
1
vote
1answer
I have a script that accepts an argument and if not set uses a default. VALUE=$1 if [[ -z "$VALUE" ]]; VALUE=foo #some function returns the default fi Then the script goes on doing somet …
asked Mar 27 '18 by Jim
-1
votes
2answers
If i have a file that contains a function foo and I have the following flow: Script A sources the file that has foo and calls foo. Then script A executes another script file that also calls foo. That …
asked Aug 30 '18 by Jim
4
votes
1answer
So I am testing the following: foo() { printf "\nAll the parameters, each on a separate line:\n" printf "param: %s\n" "$@" } foo The "nicely colored" rainbow The output is: All th …
asked Mar 26 '18 by Jim
1
vote
1answer
I have a function that returns a value. But I would like to add some echos for easier debugging. But this scrabbles the result. Example: function foo { echo "In foo" VAR="1234" echo "Calcu …
asked Mar 30 '18 by Jim
0
votes
1answer
I have a script that I didn’t write. When it is run, it outputs some information, then expects the user to press enter, and then outputs the last part of the information. This is what I need. I need t …
asked Mar 30 '18 by Jim
-1
votes
1answer
Why does the following gives the line I am searching: grep '<appointment-id internal:ref=1.2.3/>' test.xml OUTPUT is <appointment-id internal:ref=1.2.3/> While the following breaks it into 2 …
asked Jun 7 '18 by Jim
0
votes
1answer
I have a script (let’s call it scriptC) that uses getopt to parse short and long options and works fine. This script is being called like this: scriptA runs scriptB which calls scriptC with the prope …
asked May 22 '18 by Jim
2
votes
2answers
The following gives me Wednesday of the current week, i.e. yesterday's date. date -v-wednesday I need the date of next week's Wednesday. How can I do this?
asked Jun 21 '18 by Jim
0
votes
1answer
I am using expr to incremement a number that comes from a file. Although the following works: NUM=$(expr $(grep customer file.txt | cut -f4 -d' ' | sort -n | tail -n 1) + 1) I am not sure if ex …
asked Apr 16 '18 by Jim
4
votes
3answers
I have a function that depending on an argument where the functionality changes. I know I can do: function foo { PARAM1=$1 PARAM2="$2" VAR=$3 if[[ -z "$VAR" ]]; then # code her …
asked Jul 17 '18 by Jim

15 30 50 per page