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 6200543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:23:14+00:00 2026-05-24T04:23:14+00:00

The GNU version of rm has a cool -I flag. From the manpage: -I

  • 0

The GNU version of rm has a cool -I flag. From the manpage:

-I     prompt once before removing more than three files, or when removing recursively.   Less
          intrusive than -i, while still giving protection against most mistakes

Macs don’t:

$ rm -I scratch
rm: illegal option -- I
usage: rm [-f | -i] [-dPRrvW] file ...
   unlink file

Sometimes people have coreutils (the GNU version) installed on Macs and sometimes they don’t. Is there a way to detect this command line flag before proceeding? I’d like to have something like this in my bash_profile:

if [ has_gnu_rm_version ]; then
    alias rm="rm -I"
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-24T04:23:15+00:00Added an answer on May 24, 2026 at 4:23 am

    I’d say test the output of rm -I on a temp file, if it passes then use the alias

    touch /tmp/my_core_util_check
    
    if rm -I /tmp/my_core_util_check > /dev/null 2>&1 ; then
        alias rm="rm -I"
    else
        rm /tmp/my_core_util_check;
    fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The GNU/Linux version of cp has a nice --update flag: -u, --update copy only
GDB has a new version out that supports reverse debug (see http://www.gnu.org/software/gdb/news/reversible.html ). I
GNU sed version 4.1.5 seems to fail with International chars. Here is my input
I'm using GNU bash, version 3.00.15(1)-release (x86_64-redhat-linux-gnu). And this command: echo -e doesn't print
I'm working on a custom version of a GNU/Linux live distribution. I need to
I compiled 2 different binaries on the same GNU/Linux server using g++ version 4.2.3.
Although several thousand Emacs Lisp libraries exist, GNU Emacs, until version 24.1 did not
I am trying to install Python 2.7.2 from source files in my Linux machine.
I know there is this option for unix's find command: find -version GNU find
Has anyone successfully compiled the latest CVS version of Emacs on Snow Leopard? If

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.