Loading ...
Sorry, an error occurred while loading the content.

Re: [gnubies-il] Re: keyboard language to unlock session

Expand Messages
  • Tzafrir Cohen
    ... A script is a set of instructions. It tells the interpeter exactly what to do, just like a play script to an actor. A bash script is exactly what you write
    Message 1 of 9 , Sep 22, 2005
    • 0 Attachment
      On Thu, Sep 22, 2005 at 06:32:25AM -0000, shimonl wrote:
      > --- In gnubies-il@yahoogroups.com, Tzafrir Cohen <tzafrir@c...>
      > wrote:
      > >
      > > Go to tty 1. From there issue the command:
      > >
      > > DISPLAY=:0 setxkbmap us
      > >
      > > If you get an error about display permissions, you may need you
      > use
      > > something like:
      > >
      > > DISPLAY=:0 XAUTHORITY=/home/youruser/.Xauthority setxkbmap us
      > >
      > > (I'm not sure exactly what user name PCLinuxOS uses)
      >
      > Thank you VERY much, this worked perfectly.
      > Now I have a real newbie question. :-) How can
      > I create a runnable command/script called 'fixkb'
      > so that whenever this happens to me, I can just
      > go to tty1 and type:
      > $ fixkb

      A script is a set of instructions. It tells the interpeter exactly what
      to do, just like a play script to an actor.

      A bash script is exactly what you write in bash.You can use variables
      (almost, there are some minor details that differ).

      Start with creating a file with the text in it:

      # a line that begins with '#' is a comment and will be ignored.
      echo the command echo just prints text



      edit a text file, say, script.sh, and put that text in it. now run:

      bash script.sh

      this will run the commands from the script. You can also put there the
      commands to change the keyboard mapping, shutdown the computer, or
      upload virus. It's just a matter of figuring the right commands in the
      shell.

      But this still doesn't fully answer your question, because you need to
      run that script as an executable. In order to make it executable, begin
      it with the following line (must be the first line):

      #! /bin/bash


      A different executable name is allowed. You can even add command-line
      arguments. E.g: try putting there '#! /bin/bash -x' . This also has to
      be a full and correct path. Even though you can run it as 'bash' from
      the command prompt, you have to give the full /bin/bash here.

      And you also need to make it executable:

      chmod +x script.sh

      After that you should be able to run it as ./script.sh , or
      /path/to/script.sh . To run it as simplt 'script.sh , place it somewhere
      in your PATH .

      --
      Tzafrir Cohen | tzafrir@... | VIM is
      http://tzafrir.org.il | | a Mutt's
      tzafrir@... | | best
      ICQ# 16849755 | | friend
    • shimonl
      Tzafrir, Your explanations are very clear and look easy to follow and understand. Tonight I hope to try them. :-) I really appreciate the help! Thanks! ...
      Message 2 of 9 , Sep 22, 2005
      • 0 Attachment
        Tzafrir,
        Your explanations are very clear and look easy to
        follow and understand. Tonight I hope to try them. :-)

        I really appreciate the help!

        Thanks!

        >
        > A script is a set of instructions. It tells the interpeter exactly
        what
        > to do, just like a play script to an actor.
        >
        > A bash script is exactly what you write in bash.You can use
        variables
        > (almost, there are some minor details that differ).
        >
        > Start with creating a file with the text in it:
        >
        > # a line that begins with '#' is a comment and will be ignored.
        > echo the command echo just prints text
        >
        >
        >
        > edit a text file, say, script.sh, and put that text in it. now run:
        >
        > bash script.sh
        >
        > this will run the commands from the script. You can also put there
        the
        > commands to change the keyboard mapping, shutdown the computer, or
        > upload virus. It's just a matter of figuring the right commands in
        the
        > shell.
        >
        > But this still doesn't fully answer your question, because you need
        to
        > run that script as an executable. In order to make it executable,
        begin
        > it with the following line (must be the first line):
        >
        > #! /bin/bash
        >
        >
        > A different executable name is allowed. You can even add command-
        line
        > arguments. E.g: try putting there '#! /bin/bash -x' . This also has
        to
        > be a full and correct path. Even though you can run it as 'bash'
        from
        > the command prompt, you have to give the full /bin/bash here.
        >
        > And you also need to make it executable:
        >
        > chmod +x script.sh
        >
        > After that you should be able to run it as ./script.sh , or
        > /path/to/script.sh . To run it as simplt 'script.sh , place it
        somewhere
        > in your PATH .
        >
        > --
        > Tzafrir Cohen | tzafrir@j... | VIM is
        > http://tzafrir.org.il | | a Mutt's
        > tzafrir@c... | | best
        > ICQ# 16849755 | | friend
      Your message has been successfully submitted and would be delivered to recipients shortly.