Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I am using fedora distribution. There are few commands i have to enter to for a project involved such as below: # echo 0 > /proc/sys/net/ipv6/conf/eth0/forwarding # echo 1 ...
  1. #1
    Just Joined!
    Join Date
    Jul 2006
    Posts
    70

    Write a script to run several commands ???

    Hi,

    I am using fedora distribution. There are few commands i have to enter to for a project involved such as below:

    # echo 0 > /proc/sys/net/ipv6/conf/eth0/forwarding
    # echo 1 > /proc/sys/net/ipv6/conf/eth0/autoconf
    # echo 1 > /proc/sys/net/ipv6/conf/eth0/accept_ra
    # echo 1 > /proc/sys/net/ipv6/conf/eth0/accept_redirects


    May I know is there possible to write a script to run the several commands in terminal if I don't want type the command line by line?

    If yes, can you tell me how to do so? Because I have never do so before.

    Thank you.

  2. #2
    Linux Guru smolloy's Avatar
    Join Date
    Apr 2005
    Location
    CA, but from N.Ireland
    Posts
    2,413
    Easy (I hope I'm not answering a home work question). Write those commands into a text file and save it. Then execute the following at the command line,
    Code:
    chmod +x filename
    Obviously replace "filename" with whatever you called the file.

    If you want to execute the file, navigate to the directory where you saved the file, and type the following to execute all those commands
    Code:
    ./filename
    (Including the . at the start).
    Registered Linux user #388328 || Registered LFS user #15880
    AMD 64 X2 4600+ :: 2X1GB DDR2 800 :: GeForce 9400 GT 512MB :: ASUS M2N32 Deluxe :: 4X250GB SATAII
    Need instant help? Try us on IRC -- #linuxforums on freenode

Posting Permissions

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