Matching opening and closing if statements in shell script (if…fi) using PHPStorm, vscode

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I hava bunch of these nested if..then...fi 's



if [ "$var" = "NA" ] 
then
if [ "$var" != "SAM" -a "$fileFormat" != "XED" -a "$Format" != "TED" -a "$Format" != "ESTA" ]
then
echo "ERROR: Input file format not recognised"
echo "use --help for more information"
exit 1
fi
#convert esta to ted - start
if [ $fileFormat = "ESTA" ]
then
if [ $ENO != "NA" ]
then
ENO=$(greadlink -e $ENO )
fi
if [ -z "$output" ]
then
echo "WARNING"
echo "No output directory specified. Using current working directory, " $(pwd)/OUTPUT
output=$(pwd)/OUTPUT
fi
InputTed=$(greadlink -e $Inputted) #greadlink - to canonicanize/normalize to standard format
mkdir -p $output
cd $output
output=$(greadlink -e $(pwd) )
DIRECTORY=$(pwd)


In a more than 2000 line shell script. I would like to click on the opening if, and have the closing fi highlighted to easily navigate the code like it works with braces. I'm using PHPStorm, vscode but happy to try any free text editor that could do it out of the box or any plugin to these tools.










share|improve this question























  • just to clarify the wording, those are sequential ifs, not nested ifs
    – Jeff Schaller
    Aug 17 at 13:21






  • 1




    Using indentation within your code would help tremendously.
    – roaima
    Aug 17 at 13:25






  • 1




    Related, with an answer that applies to vim - Jump between the if and fi in vim, while editing a bash script?
    – roaima
    Aug 17 at 13:26







  • 1




    Further related, with instructions on making matchit.vim work - Matchit not working
    – roaima
    Aug 17 at 13:43










  • I have revised the question to give a better illustration of the scenario. Thanks for the tip on matchit, I have tried it but seems to only work on the braces. Note, am using mac os, high siera.
    – San Emmanuel James
    Aug 17 at 20:15














up vote
0
down vote

favorite












I hava bunch of these nested if..then...fi 's



if [ "$var" = "NA" ] 
then
if [ "$var" != "SAM" -a "$fileFormat" != "XED" -a "$Format" != "TED" -a "$Format" != "ESTA" ]
then
echo "ERROR: Input file format not recognised"
echo "use --help for more information"
exit 1
fi
#convert esta to ted - start
if [ $fileFormat = "ESTA" ]
then
if [ $ENO != "NA" ]
then
ENO=$(greadlink -e $ENO )
fi
if [ -z "$output" ]
then
echo "WARNING"
echo "No output directory specified. Using current working directory, " $(pwd)/OUTPUT
output=$(pwd)/OUTPUT
fi
InputTed=$(greadlink -e $Inputted) #greadlink - to canonicanize/normalize to standard format
mkdir -p $output
cd $output
output=$(greadlink -e $(pwd) )
DIRECTORY=$(pwd)


In a more than 2000 line shell script. I would like to click on the opening if, and have the closing fi highlighted to easily navigate the code like it works with braces. I'm using PHPStorm, vscode but happy to try any free text editor that could do it out of the box or any plugin to these tools.










share|improve this question























  • just to clarify the wording, those are sequential ifs, not nested ifs
    – Jeff Schaller
    Aug 17 at 13:21






  • 1




    Using indentation within your code would help tremendously.
    – roaima
    Aug 17 at 13:25






  • 1




    Related, with an answer that applies to vim - Jump between the if and fi in vim, while editing a bash script?
    – roaima
    Aug 17 at 13:26







  • 1




    Further related, with instructions on making matchit.vim work - Matchit not working
    – roaima
    Aug 17 at 13:43










  • I have revised the question to give a better illustration of the scenario. Thanks for the tip on matchit, I have tried it but seems to only work on the braces. Note, am using mac os, high siera.
    – San Emmanuel James
    Aug 17 at 20:15












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I hava bunch of these nested if..then...fi 's



if [ "$var" = "NA" ] 
then
if [ "$var" != "SAM" -a "$fileFormat" != "XED" -a "$Format" != "TED" -a "$Format" != "ESTA" ]
then
echo "ERROR: Input file format not recognised"
echo "use --help for more information"
exit 1
fi
#convert esta to ted - start
if [ $fileFormat = "ESTA" ]
then
if [ $ENO != "NA" ]
then
ENO=$(greadlink -e $ENO )
fi
if [ -z "$output" ]
then
echo "WARNING"
echo "No output directory specified. Using current working directory, " $(pwd)/OUTPUT
output=$(pwd)/OUTPUT
fi
InputTed=$(greadlink -e $Inputted) #greadlink - to canonicanize/normalize to standard format
mkdir -p $output
cd $output
output=$(greadlink -e $(pwd) )
DIRECTORY=$(pwd)


In a more than 2000 line shell script. I would like to click on the opening if, and have the closing fi highlighted to easily navigate the code like it works with braces. I'm using PHPStorm, vscode but happy to try any free text editor that could do it out of the box or any plugin to these tools.










share|improve this question















I hava bunch of these nested if..then...fi 's



if [ "$var" = "NA" ] 
then
if [ "$var" != "SAM" -a "$fileFormat" != "XED" -a "$Format" != "TED" -a "$Format" != "ESTA" ]
then
echo "ERROR: Input file format not recognised"
echo "use --help for more information"
exit 1
fi
#convert esta to ted - start
if [ $fileFormat = "ESTA" ]
then
if [ $ENO != "NA" ]
then
ENO=$(greadlink -e $ENO )
fi
if [ -z "$output" ]
then
echo "WARNING"
echo "No output directory specified. Using current working directory, " $(pwd)/OUTPUT
output=$(pwd)/OUTPUT
fi
InputTed=$(greadlink -e $Inputted) #greadlink - to canonicanize/normalize to standard format
mkdir -p $output
cd $output
output=$(greadlink -e $(pwd) )
DIRECTORY=$(pwd)


In a more than 2000 line shell script. I would like to click on the opening if, and have the closing fi highlighted to easily navigate the code like it works with braces. I'm using PHPStorm, vscode but happy to try any free text editor that could do it out of the box or any plugin to these tools.







scripting osx plugin user-interface ide






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 18 at 0:06









roaima

40.4k547110




40.4k547110










asked Aug 17 at 13:10









San Emmanuel James

62




62











  • just to clarify the wording, those are sequential ifs, not nested ifs
    – Jeff Schaller
    Aug 17 at 13:21






  • 1




    Using indentation within your code would help tremendously.
    – roaima
    Aug 17 at 13:25






  • 1




    Related, with an answer that applies to vim - Jump between the if and fi in vim, while editing a bash script?
    – roaima
    Aug 17 at 13:26







  • 1




    Further related, with instructions on making matchit.vim work - Matchit not working
    – roaima
    Aug 17 at 13:43










  • I have revised the question to give a better illustration of the scenario. Thanks for the tip on matchit, I have tried it but seems to only work on the braces. Note, am using mac os, high siera.
    – San Emmanuel James
    Aug 17 at 20:15
















  • just to clarify the wording, those are sequential ifs, not nested ifs
    – Jeff Schaller
    Aug 17 at 13:21






  • 1




    Using indentation within your code would help tremendously.
    – roaima
    Aug 17 at 13:25






  • 1




    Related, with an answer that applies to vim - Jump between the if and fi in vim, while editing a bash script?
    – roaima
    Aug 17 at 13:26







  • 1




    Further related, with instructions on making matchit.vim work - Matchit not working
    – roaima
    Aug 17 at 13:43










  • I have revised the question to give a better illustration of the scenario. Thanks for the tip on matchit, I have tried it but seems to only work on the braces. Note, am using mac os, high siera.
    – San Emmanuel James
    Aug 17 at 20:15















just to clarify the wording, those are sequential ifs, not nested ifs
– Jeff Schaller
Aug 17 at 13:21




just to clarify the wording, those are sequential ifs, not nested ifs
– Jeff Schaller
Aug 17 at 13:21




1




1




Using indentation within your code would help tremendously.
– roaima
Aug 17 at 13:25




Using indentation within your code would help tremendously.
– roaima
Aug 17 at 13:25




1




1




Related, with an answer that applies to vim - Jump between the if and fi in vim, while editing a bash script?
– roaima
Aug 17 at 13:26





Related, with an answer that applies to vim - Jump between the if and fi in vim, while editing a bash script?
– roaima
Aug 17 at 13:26





1




1




Further related, with instructions on making matchit.vim work - Matchit not working
– roaima
Aug 17 at 13:43




Further related, with instructions on making matchit.vim work - Matchit not working
– roaima
Aug 17 at 13:43












I have revised the question to give a better illustration of the scenario. Thanks for the tip on matchit, I have tried it but seems to only work on the braces. Note, am using mac os, high siera.
– San Emmanuel James
Aug 17 at 20:15




I have revised the question to give a better illustration of the scenario. Thanks for the tip on matchit, I have tried it but seems to only work on the braces. Note, am using mac os, high siera.
– San Emmanuel James
Aug 17 at 20:15















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f463182%2fmatching-opening-and-closing-if-statements-in-shell-script-if-fi-using-phpst%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f463182%2fmatching-opening-and-closing-if-statements-in-shell-script-if-fi-using-phpst%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?