Find the answer to your Linux question:
Results 1 to 3 of 3
hehe. sorry, thought it was funny. so i am trying to edit sshd_conf files to change the "#Port 22" to "Port 22" from a script. I have tried this many ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! masam's Avatar
    Join Date
    Nov 2006
    Location
    Martinsburg, WV
    Posts
    47

    [SOLVED] sed dead redemption...


    hehe. sorry, thought it was funny.

    so i am trying to edit sshd_conf files to change the "#Port 22" to "Port 22" from a script.

    I have tried this many different ways.

    sshs1='s/#Port 22/Port 22/g'
    sed $sshs1 /home/l/Desktop/test

    the reason i have it as a string in this instance is because $sshs1 gets a variable, but im not working on that right yet.
    I've tried changing the ' to ` and ".
    this is what i get:

    '
    sed: -e expression #1, char 7: unterminated `s' command

    `
    sed: -e expression #1, char 8: extra characters after command
    sed: -e expression #1, char 8: extra characters after command

    "
    sed: -e expression #1, char 7: unterminated `s' command

    i know it may have to do with my regex, but i cant seem to find a decent tut. to point me in the right direction.

    thanks in advance

  2. #2
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    sshs1='s/#Port 22/Port 22/g'
    sed $sshs1 /home/l/Desktop/test
    should probably read as

    sshs1='s/#Port 22/Port 22/g'
    sed "$sshs1" /home/l/Desktop/test
    you see: no regex problems at all. a bash guide may be more helpful in your case.

  3. #3
    Just Joined! masam's Avatar
    Join Date
    Nov 2006
    Location
    Martinsburg, WV
    Posts
    47
    haha!!
    that was awesome, but you are probably right about that.
    thank you for the enlightenment though.

  4. $spacer_open
    $spacer_close

Posting Permissions

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