5 Removed edit, added horizontal line to indicate edit.
source | link

Here's the script. It is successful when I run it from the BASH prompt, but not in the script. Any ideas?

 

EDIT: WhenWhen I say "fails," I mean the sed regex doesn't match anything, so there is no replaced text. When I run it on the command line, it matches.

Also, I might have an answer to this. It has to do with my grep alias and GREP_OPTIONS having a weird interplay. I'll post back with the details on those.

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"

Here's the script. It is successful when I run it from the BASH prompt, but not in the script. Any ideas?

EDIT: When I say "fails," I mean the sed regex doesn't match anything, so there is no replaced text. When I run it on the command line, it matches.

Also, I might have an answer to this. It has to do with my grep alias and GREP_OPTIONS having a weird interplay. I'll post back with the details on those.

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"

Here's the script. It is successful when I run it from the BASH prompt, but not in the script. Any ideas?

 

When I say "fails," I mean the sed regex doesn't match anything, so there is no replaced text. When I run it on the command line, it matches.

Also, I might have an answer to this. It has to do with my grep alias and GREP_OPTIONS having a weird interplay. I'll post back with the details on those.

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"
4 improved formatting
source | link

Here's the script. It is successful when I run it from the BASH promptBASH prompt, but not in the script. Any ideas?

EDIT: When I say "fails," I mean the sed regexsed regex doesn't match anything, so there is no replaced text. When I run it on the command line, it matches.

Also, I think I might have an answer to this, having. It has to do with my grepgrep alias and GREP_OPTIONSGREP_OPTIONS having a weird interplay. I'll post back with the details on those.

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"

Here's the script. It is successful when I run it from the BASH prompt, but not in the script. Any ideas?

EDIT: When I say "fails," I mean the sed regex doesn't match anything, so there is no replaced text. When I run it on the command line, it matches.

Also, I think I might have an answer to this, having to do with my grep alias and GREP_OPTIONS having a weird interplay. I'll post back with the details on those.

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"

Here's the script. It is successful when I run it from the BASH prompt, but not in the script. Any ideas?

EDIT: When I say "fails," I mean the sed regex doesn't match anything, so there is no replaced text. When I run it on the command line, it matches.

Also, I might have an answer to this. It has to do with my grep alias and GREP_OPTIONS having a weird interplay. I'll post back with the details on those.

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"
3 detail
source | link

Why does the same grepsed regex (after grep) fail when run in a bash script vs bash command line?

Here's the script. It is successful when I run it from the BASH prompt, but not in the script. Any ideas?

EDIT: When I say "fails," I mean the sed regex doesn't match anything, so there is no replaced text. When I run it on the command line, it matches.

Also, I think I might have an answer to this, having to do with my grep alias and GREP_OPTIONS having a weird interplay. I'll post back with the details on those.

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"

Why does the same grep regex fail when run in a bash script vs bash command line?

Here's the script. It is successful when I run it from the BASH prompt, but not in the script. Any ideas?

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"

Why does the same sed regex (after grep) fail when run in a bash script vs bash command line?

Here's the script. It is successful when I run it from the BASH prompt, but not in the script. Any ideas?

EDIT: When I say "fails," I mean the sed regex doesn't match anything, so there is no replaced text. When I run it on the command line, it matches.

Also, I think I might have an answer to this, having to do with my grep alias and GREP_OPTIONS having a weird interplay. I'll post back with the details on those.

#!/bin/bash

for ((x = 101; x <= 110; x++)); do
    urls="${urls} www$x.site.com/config"
done;

curl -s ${urls} | grep -i "Git Commit" | sed -r "s/.*Git Commit<\/td><td>([^<]+).*/\1/g"
2 edited title
| link
1
source | link