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

  • Home
  • SEARCH
  • 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 9076219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:03:50+00:00 2026-06-16T19:03:50+00:00

While trying to run this command in the terminal: gerard@yoda ~$ Sources/Scripts/ultimate.sh -u -typecount

  • 0

While trying to run this command in the terminal:

gerard@yoda ~$ Sources/Scripts/ultimate.sh -u -typecount -std /usr/bin py
Sources/Scripts/ultimate.sh: line 28: syntax error near unexpected token `elif'
Sources/Scripts/ultimate.sh: line 28: `elif [ $1 = "-h" ];'

this is the source of the script:

#!/bin/bash

## $1 = Mode(u/h) ; $2 = Command(?) ; $3+ = Params

if [ $1 = "-u" ];
    if [ $2 = "-typecount" ];
    then
        if [ $3 = "-std" ];
        then
            find $4 -maxdepth 1 -iname *.$5 | wc -l
        elif [ $3 = "-ext" ];
        then
            find $5 -maxdepth $4 -iname *.$6 | wc -l
        else
            echo 'use option -std for single-dir'
            echo 'or option -def for recusive with custom depth'
            echo 'filetype should be defined  type  instead of .type'
        fi
    elif [ $2 = "-prep" ];
    then
        sed -i 's/^/$3/' $4
    elif [ $2 = "-app" ];
    then
        sed -i 's/$/$3/' $4
    else
        echo 'No command specified/Command not found'
    fi
elif [ $1 = "-h" ];
then
    if [ $2 = "-typecount" ];
    then
        echo 'for -std: [location] [type]'
        echo 'for -ext: [depth] [location] [type]'
    elif [ $2 = "-prep" ];
    then
        echo '[text] [file]'
    elif [$2 = "-app" ];
    then
        echo '[text] [file]'
    else
        echo 'No command specified/Command not found'
else
    echo 'No mode specified/Wrong mode'
fi

The syntax appears correct to me, and a simpler version of the script, with same elif construction works fine. What did I do wrong? (the script needs to quit after the desired function is parsed)

  • 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-16T19:03:51+00:00Added an answer on June 16, 2026 at 7:03 pm

    At the top you don’t have a then keyword after the first if.

    if [ $1 = "-u" ];
    **then**
        if [ $2 = "-typecount" ];
    

    You’re also missing an fi near the bottom:

        else
            echo 'No command specified/Command not found'
        **fi**
    else
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While trying to run this command: tesseract bond111.tif bond111 batch.nochop makebox I get the
I am trying to run this command on linux... compilation is successfull but while
Has anyone ever seen this error while trying to run an android application in
I'm trying to run /usr/bin/perl -e 'for(my $i=0;$i<1000;$i++){print 1x1000;print STDERR 2x1000;}' (which works in
Im trying to run this code . Basically I want the https://admin:qwerty123@ '$dmp':7777/set_param?'$params command
While trying to run the booking sample , the decider gets invoked 4 times
I am getting an error while trying to run CFmx code on a remote
I was following Azure Tutorial and found error while trying to run the Azure
I've run into an issue while using ExtJS 4.0.7. I'm trying to display a
I am using the combination mentioned in the title while trying to run the

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.