Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6135223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:27:11+00:00 2026-05-23T17:27:11+00:00

Since Solaris grep by default doesn’t have the -E option, I would have to

  • 0

Since Solaris grep by default doesn’t have the -E option, I would have to update my bash to work with a specific grep. This is what I do.

It works on the command line, but when I put it in the bash file, it looks like the script doesn’t pick it up and still uses the normal grep. (I do not want to change the whole $PATH.)

Please advise:

export isSolaris=`uname -a | grep -i "sunos"`
if  [ -n "$isSolaris" ]; then
        alias grep="/usr/xpg4/bin/grep -E";
fi
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:27:12+00:00Added an answer on May 23, 2026 at 5:27 pm

    bash and ksh don’t process aliases defined in a file until after the file is read… which means you can’t define it in the same script that will use it. You can put it in another file and . (source) that into your script, though.

    Alternately, use a shell function.

    mygrep() {
      if test -n "$isSolaris"; then
        /usr/xpg4/bin/grep -E ${1+"$@"}
      else
        grep ${1+"$@"}
      fi
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been using 'bash' since the time I have been using Unix- Linux/Solaris.
since they have same rendering engine, this problem shows in both. it works great
Since CS3 doesn't have a web service component, as previous versions had, is there
Since I'm pretty new this question'll certainly sound stupid but I have no idea
Since debate without meaningful terms is meaningless , I figured I would point at
Since Rails is not multithreaded (yet), it seems like a threaded web framework would
I have a Solaris sparc (64-bit) server, which has 16 GB of memory. There
I'm running 64-bit Solaris 10, and I have self-compiled Perl 5.10 and Postgresql 8.4.1
This might be a basic question but i wanted to ask since i am
Since i'm writing a game in RoR, i need to have a game loop

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.