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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:49:45+00:00 2026-06-16T01:49:45+00:00

The if statement doesn’t seem to be functioning correctly, no matter the if statement

  • 0

The if statement doesn’t seem to be functioning correctly, no matter the if statement result, the program launches. What have I missed?

#!/bin/bash

dtime=($(date |cut -c12-13))
sevenO="19"
redshift=($(gtk-redshift -l -31.9530044:115.8574693))

if ( [[ "$dtime" -gt "$sevenO" ]])
then
    $redshift
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-06-16T01:49:47+00:00Added an answer on June 16, 2026 at 1:49 am

    Do I understand correctly that you only want to run gtk-redshift if the time is between 8 PM and midnight? If so, the problem is that this notation:

    $(...)
    

    runs the command ... immediately, and evaluates to its output; so this statement:

    redshift=($(gtk-redshift -l -31.9530044:115.8574693))
    

    runs the command gtk-redshift -l -31.9530044:115.8574693, and then sets the variable redshift to be an array containing the output of that command. (An array because of the surrounding (...). Note that in Bash, parentheses are not used for mere grouping. They have actual behaviors — such as, in this case, creating an array — and you shouldn’t use them in places where you don’t want those behaviors.)

    You can simplify your Bash script to just this:

    #!/bin/bash
    
    if [[ "$(date +%k)" -ge 20 ]] ; then
        gtk-redshift -l -31.9530044:115.8574693
    fi
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a switch case statement that doesn't work. I've checked the input, it's
I'm writing a program and my if statement doesn't give the expected output. I
The using statement doesn't capture exceptions. To catch exceptions you have two choices: 1)
I'm very confused why the SELECT statement doesn't work correctly. It doesn't give me
I want to start 100 processes in bash , but the for statement doesn't
I'm kind of stuck on something... my else statement doesn't seem to be working
I got the problem that the if-statement doesn't work. After the first code line
Starting from this official statement that all xyAndroid versions previous API 11 doesn't support
Why isn't my if-statement working? It doesn't accept NSCFStrings... Basically I'm doing this: if
I'm trying to write an IF ELSE statement to enable shipping, If user doesn't

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.