Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

grep oddity

Featured Replies

 

When I run this it returns "redwhe" as expected.

s=`echo "[redwhe]" | grep '\[redwhe\]'`;echo $s

 

 

When I run this in a telnet window it returns only the letter "t".  Why? 

 

s=`echo "[redwhte]" | grep '\[redwhte\]'`;echo $s

 

 

When I run this it returns "redwhe" as expected.

s=`echo "[redwhe]" | grep '\[redwhe\]'`;echo $s

 

 

When I run this in a telnet window it returns only the letter "t".  Why? 

 

s=`echo "[redwhte]" | grep '\[redwhte\]'`;echo $s

 

works for me...

root@Tower:~# s=`echo "[redwhte]" | grep '\[redwhte\]'`;echo $s

[redwhte]

root@Tower:~#

  • Author

Weird.  Here is what I get every time.  I distilled the actual code down to just this but it happens every time in a script that runs as root.

grepoddity.jpg.a29f5c4d320496e48155cb1aef63ceeb.jpg

works for me too.

I tried with secure CRT and microsoft's telnet program.

 

EDIT:  Works ok in putty too.

 

What terminal program are you using?

  • Author

How did I get so lucky?  It happens inside a script that gets kicked off automatically so it isn't the telnet session doing it.  Could it be the version of linux?  

 

uname -r = 2.6.32.9-unRAID

Weird.  Here is what I get every time.  I distilled the actual code down to just this but it happens every time in a script that runs as root.

 

Try

s=`echo "[redwhte]" | grep '\[redwhte\]'`;echo $s | od -c

 

Let's see what you are actually echoing, not what your shell might be hiding from you.

  • Author

Weird.  Here is what I get every time.  I distilled the actual code down to just this but it happens every time in a script that runs as root.

 

Try

s=`echo "[redwhte]" | grep '\[redwhte\]'`;echo $s | od -c

 

Let's see what you are actually echoing, not what your shell might be hiding from you.

 

See attached.

grepoddity2.jpg.087bbbe620bd2eb3ff43d63784fdce0a.jpg

  • Author

Oh, dang.  Remember back a few days when someone posted this.  I stuck it in my go script and forgot to take it back out.  

It just hit me that maybe...and yep, it messed stuff up.  Gads, I'm sorry.  Wow, I just learned my lesson.

 

sed -i 's/Restore/Destroy/g' /usr/local/sbin/emhttp

Oh, dang.  Remember back a few days when someone posted this.  I stuck it in my go script and forgot to take it back out.  

It just hit me that maybe...and yep, it messed stuff up.  Gads, I'm sorry.  Wow, I just learned my lesson.

 

sed -i 's/Restore/Destroy/g' /usr/local/sbin/emhttp

I doubt it was that, but yes, something has messed up your shell.
  • Author

Oh, dang.  Remember back a few days when someone posted this.  I stuck it in my go script and forgot to take it back out.  

It just hit me that maybe...and yep, it messed stuff up.  Gads, I'm sorry.  Wow, I just learned my lesson.

 

sed -i 's/Restore/Destroy/g' /usr/local/sbin/emhttp

I doubt it was that, but yes, something has messed up your shell.

 

Ok, this is weird.  I took that out of the go script and then tested again and I get back the whole [redwhte]  string.  Yet, they can't be related because I didn't run the go again.  What's happening?  Immediately after running your script piece with the od -c I edited the go script and then started working correctly.

 

Edit:  I rebooted and it's not happening anymore.  Thanks for helping.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.