I have the following script setup at the moment:
#!/bin/bash while true; do echo "Type in keyword & press enter..." read KEYWORD HERE=$(grep -i "$KEYWORD" */*/webvirtualmx) echo $HERE ANSWER2="y";read -p "Do you want to move to old? y or n?" ANSWER2; if [ "$ANSWER2" = "y" ] then mv -i -v $HERE /u1/OLD fi ANSWER="n";read -p "Do you have more keywords? y or n?" ANSWER; if [ "$ANSWER" = "n" ] then break fi done
Now the output of the echo part of the script looks like this:
I basically need to cut the "webvirtualmx:servingtruth.org" portion off from the path, so that the part of the code that runs the mv command, moves the entire directory, not just the file.
How would I go about telling to ignore the entire path, and only grab the directories path and apply it to the variable $HERE?
mv -i -v u/umind/ /u1/OLD/
I have about a hundred directories like this, obviously all named differently but they all follow this pattern:
so on and so forth.