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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:02:57+00:00 2026-06-04T17:02:57+00:00

In my .bashrc I have the following code if [`uname` == "Linux"]; then echo

  • 0

In my .bashrc I have the following code

if [`uname` == "Linux"]; then
    echo "It worked"
else
    echo "It didn't work"
fi

But when I source my .bashrc I get the following results

[Linux: command not found

It didn’t work

Strangly, the [ is not a typo, it is part of the error. If I comment out the if-statement, then the error goes away, so I am pretty sure that it is the source of the error. Plus, if I change the Linux to linux, then the error changes to lowercase also.

And if I echo uname I get Linux.

To source my .bashrc I have used source .bashrc and also have started a new bash session by typing bash on the command line terminal.

I didn’t think it was that hard to check for the OS type, but I can’t seem to figure out the correct syntax for the .bashrc.

I don’t see what I am doing wrong, can anyone help?

  • 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-06-04T17:02:59+00:00Added an answer on June 4, 2026 at 5:02 pm

    You forgot a space after the square brackets. The first line has to look like this:

    if [ `uname` == "Linux" ]; then
    

    In your version, without the spaces, the [ and the output of uname is concatenated into one executable named [Linux, which does not exist in the PATH.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found following few lines of code in .bashrc in my linux instance. could
I have the following in my .bashrc file: # Git Bash Completion source $HOME/.git_completion
i have the following alias set in my .bashrc: alias la='ls -laG' but i
I have the following in a file which is sourced both by .bashrc and
In my .bashrc file I have included the following: GIT_PS1_SHOWDIRTYSTATE=true GIT_PS1_SHOWUNTRACKEDFILES=true GIT_PS1_SHOWUPSTREAM=verbose git export
I don't have .bashrc file, I want to create one but how? And what
So currently I have included the following in my .bashrc file. export RUBYLIB=/home/git/project/app/helpers I
Stevey recommends to set the following command to .bashrc TERM=xterm-256color I put the code
I have a .bashrc file with the following commands: PS1=... export LC_ALL=... What are
I have a problem that I tried to ask about previously, but didn't get

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.