How Ubuntu uses the source command to execute files

  
                

The Ubuntu source command is used to make the configuration information set in the file take effect immediately without restarting. This article will give you a tutorial on Ubuntu using the source command to execute files.

source command usage:

source filename or. Filename

The source command has another use in addition to the above. It is often necessary to enter a long list of commands when compiling the system kernel, such as:

make mrproper

make menuconfig

make dep

make clean< Br>

make bzImage

…………

If you make these commands into a file and let it execute sequentially, it is necessary to repeatedly compile the system core multiple times. Users will be very convenient, and you can do this with the source command. Its role is to execute the contents of a file as a shell, first in the Linux source code directory (such as /usr/src/linux- 2.4.20) Create a file, such as make_command, and type in the content:

make mrproper &&

make menuconfig &&

make dep & ;&

make clean &&

make bzImage &&

make modules &&

make modules_install && ;

cp arch/i386/boot/bzImage /boot/vmlinuz_new &&

cp System.m Ap /boot &&

vi /etc/lilo.conf &&

lilo -v

After the file is created, each time the kernel is compiled Just type in /usr/src/linux-2.4.20:

source make_command

Just fine, if you are not using lilo to boot the system, you can remove the last two lines. , configure your own bootloader to boot the kernel.

By the way, the && command indicates that the command connected by it is executed sequentially, but the command following it can be executed only after the successful execution of the previous command.

In addition, if the command command is not executed when the source command is executed, it is because the environment variable is not configured. You can fix it by running the following command in the terminal:

export PATH=/usr/local/Sbin: /usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

The above is the tutorial for Ubuntu to use the source command to execute the file. I have listed an example, I hope that users can actually experience it.

Copyright © Windows knowledge All Rights Reserved