1 Reply Latest reply on Sep 2, 2015 7:03 AM by DiegoV_Intel

    Script Intel Galileo Gen1 - Linux SD

    AntonioG

      Hello to all the community.

       

      I'm running a Yocto Linux image in sd for Intel Galileo gen1. I want to create a script or a file containing a series of commands to run when I want and not have to re-repeating those same commands as they are always the same (or almost always) e.g.

       

      root@quark:~# ifconfig wlan0 down

      root@quark:~# ip link set wlan0 down

      root@quark:~# iwconfig wlan0 mode ad-hoc

      root@quark:~# iwconfig wlan0 channel 5

      ...

      root@quark:~# ifconfig wlan0 up

      root@quark:~# ip link set wlan0 up

       

      Is there any way to create a script like there is in Linux to run ./test and sequentially commands you want to run?

       

      Thank you very much in advance.

       

      AntonioG

        • 1. Re: Script Intel Galileo Gen1 - Linux SD
          DiegoV_Intel

          Hello AntonioG,

           

          Sure, there is a way to do that. You have to write a shell script and then run it whenever you want. Every time the shell script is executed, the commands in it will be executed too. I wrote a quick example below. To run it you have to copy it in a directory of your preference, for example the /home directory, and then run the command sh /home/shell_script.sh. Notice that the file extension is .sh. You can change the name "shell_script" for any other name you want.

           

          #!/bin/sh
          # Example of a shell script
          echo ""
          echo "Example of a shell script"
          echo ""
          # Run the 'pwd' command
          echo "Running the 'pwd' command.."
          pwd
          echo ""
          #Run the 'ls' command
          echo "Running the 'ls' command..."
          ls
          echo ""
          

           

          Regards,

          Diego.