nash

Langue: en

Autres versions - même langue

Version: 66221 (mandriva - 22/10/07)

Autres sections - même nom

Section: 8 (Commandes administrateur)

NAME

nash - script interpretor to interpret linuxrc images

SYNOPSIS

nash [--quiet] [--force] script

DESCRIPTION

nash is a very simple script interpretor designed to be as small as possible. It is primarily designed to run simple linuxrc scripts on an initrd image. Arguments to commands may be enclosed in either single or double quotes to allow spaces to be included in the arguments. Spaces outside of quotations always delineate arguments, and so backslash escaping is supported.

Additionally, if nash is invoked as modprobe, it will immediately exit with a return code of zero. This is to allow initrd's to prevent some extraneous kernel error messages during startup.

There are two types of commands, built in and external. External commands are run from the filesystem via execve(). If commands names are given without a path, nash will search it's builtin PATH, which is /usr/bin, /bin, /sbin, /usr/sbin.

Currently, nash supports the following built in commands.

access -[r][w][x][f] path
Tells whether the current user has sufficient permissions to read, write, or execture path, or if the file exists (see access(2) for more information).
echo [item]* [> filename]
Echos the text strings given to a file, with a space in between each item. The output may be optionally redirected to a file.

exec <command> The command given is execed, overlaying the nash process.

find dir -name name
Display the path to files named name in or below directory dirFR. This is a very limited implementation of find(1).
findlodev
Prints the full path to the first unused loopback block device on the system. If none is available, no output is displayed.
insmod
If nash is running on kernel 2.5 or greater it will load the specified module. If it is running on a previous kernel it will invoke an external insmod command to load the module.
losetup /dev/loopdev file
Binds file to the loopback device /dev/loopdev. See losetup(8) for information on loopback devices.
mkdevices [path]
makedev [path] Creates device files for all of the block devices found under /sys/block or listed in /proc/partitions in the directory specfied by path, or /dev if path is not specified.
mkdir [-p] path
Creates the directory path. If -p is specified, this command will not complain if the directory exists. Note this is a subset of the standard mkdir -p behavior.
mknod path [c|b] major minor
Creates a device inode for path. This is identical to mkdev(1) which the exceptions that it will not create named pipes and if the directories in path do not exist they will be automatically created.
mkdmnod
Creates a device inode for the device mapper control inode as /dev/mapper/control. If it already exists with the correct major/minor, it will not be recreated.
mkrootdev path
Makes path a block inode for the device which should be mounted as root. To determine this device nash uses the device suggested by the root= kernel command line argument (if root=LABEL=XXXXXX or root=UUID=XXXXXX is used devices are probed to find one with that label or uuid). If no root= argument is available, /proc/sys/kernel/real-root-dev provides the device number.
mount [--ro] [--bind] -o opts -t type device mntpoint
Mounts a filesystem. It does not support NFS, and it must be used in the form given above (arguments must go first). If device is of the form LABEL=foo the devices listed in /fB/proc/partitions will be searched, and the first device with a volume label of foo will be mounted. Normal mount(2) options are supported, in addition the --ro option will mount the filesystem read only regardless of actual options, the --bind option will cause a bind mount. The defaults mount option is silently ignored.
mountdev
Useful if initrd uses a read-only filesystem, if /devfs is not in use it will mount a tmpfs over /dev and create some basic device file.
pivot_root newrootpath oldrootpath
Makes the filesystem mounted at newrootpath the new root filesystem, and mounts the current root filesystem as oldrootpath.
raidautorun mddevice
Runs raid autodetection on all raid-typed partitions. mddevice must be a raid device (any will do).
readlink path
Displays the value of the symbolic link path.
remountdev [-f] path
remount /dev onto the specified path if it is a devfs or the -f (force) flag is given. It is needed before using switchroot if using devfs or udev, to remount the tmpfs on the new root.
setquiet
Cause any later echos in this script to not be displayed.
showlabels
Display a table of devices, their filesystem labels, and their uuids.
sleep num
Sleep for num seconds
switchroot newrootpath
Makes the filesystem mounted at newrootpath the new root filesystem by moving the mountpoint. This will only work in 2.6 or later kernels.
umount path
Unmounts the filesystem mounted at path.

RETURN VALUE

Returns 0 is the last command succeeded or 1 if it failed.

OPTIONS

--force
Allows force really execute the script, even though nash doesn't appear to be running from an initrd image.

BUGS

Probably many. nash is not a shell, and it shouldn't be thought of as one. It isn't entirely different from a shell, but that's mostly by accident.

AUTHOR

 Erik Troan <ewt@redhat.com>
 Patches for MandrakeSoft by Guillaume Cottenceau <gc at mandrakesoft.com> and
 Luca Berra <bluca at vodka.it>