Skip to main content
deleted 1 character in body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem (for Solaris) in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin/:$PATH"
fi

If not, why not?

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem (for Solaris) in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin/:$PATH"
fi

If not, why not?

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem (for Solaris) in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin:$PATH"
fi

If not, why not?

added 14 characters in body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem (for Solaris) in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin/:$PATH"
fi

If not, why not?

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin/:$PATH"
fi

If not, why not?

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem (for Solaris) in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin/:$PATH"
fi

If not, why not?

added 104 characters in body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliantPOSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin/:$PATH"
fi

If not, why not?

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin/:$PATH"
fi

If not, why not?

I occasionally do work on an older Solaris machine whose default version of grep is non-POSIX-compliant. This causes problems in my rc files because the default grep on the machine doesn't support the options I need.

This is a machine at my place of work, and I'm not an admin; so I can't just install newer/better versions of commands as I see fit. However, I notice that the machine does have a suitable XPG version of grep at /usr/xpg4/bin/grep.

Obviously, I can solve the problem in my rc files with:

alias grep='/usr/xpg4/bin/grep'

But what about machines where this isn't necessary? My goal is to have a single rc file for each shell that I can drop into any Unix-like system and have it just work.

This got me thinking...

  1. Is there ever a case where I wouldn't want to use the XPG version of a command?
    • If so, when?
  2. Couldn't I just blindly add /usr/xpg4/bin/ to the beginning of $PATH in my rc files on all machines and forgo aliasing individual commands to their XPG* versions?
    • Or will this cause problems for some commands?
  3. Is it the case that /usr/xpg4/bin/ exists only on machines where it is "necessary"?
    • I ask because I notice that /usr/xpg4/bin/ doesn't exist on my Ubuntu machine.

So to sum up, is this a good a idea?

if [ -d "/usr/xpg4/bin" ]; then
  #Place XPG directory at beginning of path to always use XPG version of commands
  export PATH="/usr/xpg4/bin/:$PATH"
fi

If not, why not?

added 17 characters in body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42
Loading
edited body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42
Loading
added 147 characters in body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42
Loading
added 22 characters in body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42
Loading
added 117 characters in body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42
Loading
added 53 characters in body
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42
Loading
Source Link
Sildoreth
  • 2k
  • 8
  • 25
  • 42
Loading