Results 1 to 4 of 4

Thread: Shell script problem with Enter key

  1. #1
    Join Date
    Sep 2007
    Location
    Nashville, TN
    Beans
    190
    Distro
    Ubuntu Mate Development Release

    Shell script problem with Enter key

    Hi I have a sync/backup shell script that had been working for a while and all of a sudden it is acting weird.
    Basically I am trying to sync /home to /home on an external drive but somehow the script creates a new /home (with some spaces, or maybe an "Enter" sign).
    The following is my code:
    Code:
    #!/bin/sh
    sudo rsync -rtpogv --progress --delete --exclude=/guest --exclude=/lost+found --exclude=/xxx/.gvfs --exclude=/xxx/.cache --exclude=/*/firefox/"Crash Reports" --exclude=/*/firefox/*/Cache --exclude=/*/firefox/*/minidumps -u -l -H /home  /media/Shared/home(note: no space here, but "Pressed Enter" to go to next line!!!)
    sudo rm -R /media/Shared/etc/
    sudo cp -R /etc/ /media/Shared/etc/
    It seems the terminal is interpreting the "Enter" here as a character something.
    Can somebody help?
    I use Ubuntu 10.04
    ASRock ION3D 152D Intel Atom D525 (1.8GHz, dual-core) NVIDIA GT218-ION 1 x HDMI 2GB/320GB, Ubuntu Mate 18.04

  2. #2
    hakermania's Avatar
    hakermania is offline Τώρα ξέρεις τι γράφω εδώ!
    Join Date
    Aug 2009
    Location
    Greece
    Beans
    1,705
    Distro
    Ubuntu Development Release

    Re: Shell script problem with Enter key

    hello
    A small thought:
    Code:
    #!/bin/sh
    sudo rsync -rtpogv --progress --delete --exclude=/guest --exclude=/lost+found --exclude=/xxx/.gvfs --exclude=/xxx/.cache --exclude=/*/firefox/"Crash Reports" --exclude=/*/firefox/*/Cache --exclude=/*/firefox/*/minidumps -u -l -H /home  /media/Shared/home/;
    sudo rm -R /media/Shared/etc/;
    sudo cp -R /etc/ /media/Shared/etc/;
    ; shows where exactly the commands end and won't take any newline characters
    Last edited by hakermania; July 30th, 2011 at 02:05 PM.

  3. #3
    Join Date
    Sep 2007
    Location
    Nashville, TN
    Beans
    190
    Distro
    Ubuntu Mate Development Release

    Re: Shell script problem with Enter key

    That works! wow it is THAT easy, I really need to learn some scripting.
    Thank you @Haker!
    ASRock ION3D 152D Intel Atom D525 (1.8GHz, dual-core) NVIDIA GT218-ION 1 x HDMI 2GB/320GB, Ubuntu Mate 18.04

  4. #4
    hakermania's Avatar
    hakermania is offline Τώρα ξέρεις τι γράφω εδώ!
    Join Date
    Aug 2009
    Location
    Greece
    Beans
    1,705
    Distro
    Ubuntu Development Release

    Re: Shell script problem with Enter key

    Quote Originally Posted by zhanglini View Post
    That works! wow it is THAT easy, I really need to learn some scripting.
    Thank you @Haker!
    You're welcome
    And yes, a little bit of scripting helps

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •