in Education by
What's the preferred way to determine if a given ksh invocation is running an interactive shell? I have some commands in an ENV file that I would like to skip for non-interactive ksh invocations (e.g. when executing a shell script). I've seen suggesting ranging from: if [[ $- = *i* ]]; then # do interactive stuff fi ...to not even sourcing .kshrc unless the shell is determined to be interactive using this cryptic incantation: ENVIRON=$HOME/.kshrc export ENVIRON ENV='${ENVIRON[(_$-=1)+(_=0)-(_$-!=_${-%%*i*})]}' export ENV JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I have found checking the $- variable for the 'i' flag the best method in ksh. if [[ $- = *i* ]]; then #do interactive stuff fi

Related questions

0 votes
    I have a parameters.ini file, such as: [parameters.ini] database_user = user database_version = 20110611142248 I want to ... I do this? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    Why we use script mode for python programming while we have the interactive mode. Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    I want to run a python script from a shell script. I have been able to run it from the "command ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 26, 2022 in Education by JackTerrance
0 votes
    I want to run a python script from a shell script. I have been able to run it from the "command ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    In shell script, How can I set 0 as default value to parameter. param2=0 ${2:-0} and ${2 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    In Intellij IDE's such as PyCharm or Idea there is an option to customize the menu and toolbar by ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    write a shell script to obtain any numbers of argument and print them in the reverse order? Select the correct answer from above options...
asked Dec 21, 2021 in Education by JackTerrance
0 votes
    write a shell script to generate all combination of 1 2 and 3 Select the correct answer from above options...
asked Dec 19, 2021 in Education by JackTerrance
0 votes
    write a shell script to generate all combination of 1 2 and 3 Select the correct answer from above options...
asked Dec 18, 2021 in Education by JackTerrance
0 votes
    What is the use of "$?" sign in shell script?...
asked May 28, 2021 in Technology by JackTerrance
0 votes
    What are the different types of variables used in shell script?...
asked May 28, 2021 in Technology by JackTerrance
0 votes
    Why is the use of shell script?...
asked May 28, 2021 in Technology by JackTerrance
0 votes
    What is shell script?...
asked May 28, 2021 in Technology by JackTerrance
...