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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:01:36+00:00 2026-06-17T03:01:36+00:00

I am writing a shell script that gets me the status of a directory

  • 0

I am writing a shell script that gets me the status of a directory in svn then loops through it and either adds or deletes the files.

This svn command

$ svn status /myLocalDir/files

returns files i have either added or deleted locally. ? = add, ! = deleted

!        /myLocalDir/files/deletedPicture.png
?        /myLocalDir/files/addedPicture.png

Im using a loop in my bash script (see below). What i need to do is, when i loop through my root directory of the files/folders that have been either added, or deleted, I need to

A. print out “Deleting” [X] or “Adding” [X]

B. Determine based on the first char (?,!) if I should delete or add the current file in the loop to svn.

Im just not sure the syntax of how to parse the string “! /myLocalDir/files/deletedPicture.png” to do that

for X in `svn status /myLocalDir/files | cut -c 8-300`
            do  
                if [ "!" ]
                    then
                        echo "Deleting " $X
                        #svn $CREDENTIALS delete $X
                    else
                        echo "Adding " $X
                        #svn $CREDENTIALS  add $X
                fi

            done

one other thing i am noticing.. even thought svn status in the command line

!        /myLocalDir/files/deletedPicture.png
?        /myLocalDir/files/addedPicture.png

my bash loop echo’s like this

!        
/myLocalDir/files/deletedPicture.png
?
/myLocalDir/files/addedPicture.png
  • 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-17T03:01:37+00:00Added an answer on June 17, 2026 at 3:01 am

    Thanks for all the input!! but this is what i went with.. all i really needed to do was determine base on the first char of a string which was delete and which was add so I substring’d it. I replaced the spaces with dashes which solved my for looping issue and then I substring each one for my condition

    for X in `svn status /myLocalDir/files |tr " " "-"`
                do  
                    if [ ${X:0:1} == "!" ]
                        then
                            echo "Deleting " ${X:8}
                            svn delete ${X:8}
                        elif [ ${X:0:1} == "?" ]
                            echo "Adding " ${X:8}
                            svn add ${X:8}
                    fi
    
                done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I am writing a shell script that gets all the current processes running,
I am writing a shell script that will perform 2 tasks. One task will
I'm writing a shell script that before running needs to check that system Perl
I am writing a POSIX shell script that may or may not receive input
I'm writing a shell script to backup the contents of the current directory to
I am writing some BASH shell script that will continuously check a file to
I'm writing a small shell script that needs to reverse the lines of a
I'm writing a shell script (tcsh) that is supposed to received 3 parameters or
I'm writing a shell script. A variable will have a url that will look
I'm writing a shell script that makes sure my DNS server is looking. Here's

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.