A Bash Issue


  1. argedion

    argedion The TechnoFrog Moderator

    I have a bash file I am working on and I am a bit stumped at one part I can't seem to figure out why I am getting this error. What I have is an adb bash to pull from data, system, and sdcard. At the moment I can do the sdcard with out an issue but when I try to do data and system I get the error "./:" is a directory.
    here is what I have so far. I have looked for syntax errors but can't see them.

    [HIGH]function Save_data
    {
    #/ save the media to local folder

    #/run/media/argedion/750Data/home/phone/adb
    echo "Make Local Folder: /run/media/argedion/750Data/home/phone/adb"/`date +%Y%m%d`"_Data"/
    mkdir "/run/media/argedion/750Data/home/phone/adb"/`date +%Y%m%d`"_Data"/
    cd "/run/media/argedion/750Data/home/phone/adb"/`date +%Y%m%d`"_Data"/
    echo "Now starting the Pull Process"
    `adb pull /data/` "./"
    echo "Pull is finished"

    }

    function Save_system
    {
    #/ save the media to local folder
    echo "Make Local Folder: /run/media/argedion/750Data/home/phone/adb"/`date +%Y%m%d`"_System"/
    mkdir "/run/media/argedion/750Data/home/phone/adb"/`date +%Y%m%d`"_System"/
    cd "/run/media/argedion/750Data/home/phone/adb"/`date +%Y%m%d`"_System"/
    echo "Now starting the Pull Process"
    `adb pull /system/` "./"
    echo "Pull is finished"

    }[/HIGH]

    The SDCARD one runs with out the error
    [HIGH]function Save_Media
    {
    #/ save the media to local folder
    echo "Make Local Folder: /home/argedion/sdcard"/`date +%Y%m%d`"_LTESDCARD"/
    mkdir "/home/argedion/sdcard"/`date +%Y%m%d`"_LTESDCARD"/
    cd ~/sdcard/`date +%Y%m%d`"_LTESDCARD"/
    echo "Now starting the Pull Process"
    `adb pull /mnt/sdcard/` "./"
    echo "Pull is finished"

    }[/HIGH]

    the error shows that
    line 65 "./:" is a directory. (the line is `adb pull /data/` "./")

    Now it is important to know that I can get everything from data before the error or I can get everything from system before the error but if i try to go from data to system then i only get data and then the error

    yet the same code works flawlessly with the SDCARD

    Advertisement
  2. Prinny

    Prinny Resident Linux Nutcase Guide

    cd "/run/media/argedion/750Data/home/phone/adb"/`date +%Y%m%d`"_System"/

    Looking at that. I'm pretty tired. But shouldn't it be similar to the last one? eg:

    cd ~/run/media/......?

    Or is it in " from / to adb because it needs to be? I haven't made too many bash scripts...but why not try it that way? Remove the quotes and cd ~/run

    Unless you've tried that already. Then..I'm not sure o.o
    argedion likes this.
  3. SUroot

    SUroot Well-Known Member Developer

    Yeah I would firstly try and replicate the structure from SD card in data and system

    mkdir "/home/argedion/data"/`date +%Y%m%d`"_data"/
    mkdir "/home/argedion/system"/`date +%Y%m%d`"_system/

    Try and get that working first to rule out any local issues on your computer FS
    argedion likes this.
  4. argedion

    argedion The TechnoFrog Moderator

    Well It still gives me an error even when I change the directory to /home/argedion/phone/

    so don't think it is a structure issue.
  5. SUroot

    SUroot Well-Known Member Developer

    The same error?
  6. SUroot

    SUroot Well-Known Member Developer

    The only syntax difference I can see is the method in which you cd. So did you change your scripts exactly as I suggested? If so, perhaps also match the cd type just to clarify.

    Why are you using "./"
  7. argedion

    argedion The TechnoFrog Moderator

    ok removed all " and it seems to be working fine for going from data to system and the ./ is to tell it to save in the current directory which is the directory we saved to other wise it will save it in the same directory as the bash (my bin directory) originally before the quotes I was getting errors with the SDCARD save data though seems to be doing fine with out the quotes I'll report back on system and SDCARD with out the quotes.
  8. argedion

    argedion The TechnoFrog Moderator

    Everything is fine originally i must have had an error that putting the quotes to I solved "Accidently" maybe a space or something i didn't see. Now all is well thanks guys for your help :D

Share This Page