Bash if Result Empty Try Again 3 Times

Chapter 3 Working with Files and Directories

The SunOS control line is used to dispense files and directories. You type in the file and directory names in conjunction with SunOS commands to carry out specific operations. This is different than using the OpenWindows File Managing director, where files are displayed as icons that tin can be clicked on and moved, and commands are selected from menus.

This affiliate introduces you to the concepts and procedures used to work with files and directories from the SunOS control line. These operations apply to any SunOS command line, whether yous are using a Shell or Command Tool in the OpenWindows environment or are logged in from a remote concluding. To fully make utilise of the SunOS operating system it is essential for you to sympathize the concepts presented in this chapter.

three.1 File Concepts

The file is the basic unit in the SunOS operating organisation. Almost everything is treated as a file, including:

  • Documents--These include text files, such as letters or reports, reckoner source lawmaking, or anything else that yous write and want to salve.

  • Commands--Most commands are executable files; that is, they are files you can execute to run a particular program. For example, the date control that y'all saw in the previous chapter, which executes a program that provides the current date, is an executable file.

  • Devices--Your last, printer, and deejay drive(s) are all treated as files.

  • Directories--A directory is simply a file that contains other files.

The following section explains the commands available for creating, listing, copying, moving, and deleting files. You'll also see how to list the contents of a file and how to determine the nature of a file.

3.2 Using File Commands

Each of the commands presented in this department includes an example of how the command is used. Endeavour the examples as yous read the text. This practice will make the commands and their respective concepts easier to understand and recollect.

three.2.i Earlier Yous Begin

Before y'all showtime experimenting with files, brand sure that you are in your home directory. This is a directory established for y'all past your system administrator when your business relationship was created. If you perform the tasks shown in the following examples from your dwelling directory, yous'll be less likely to create, copy, motility, or (worst of all) delete files within portions of the system that other users expect to remain unchanged.

To make certain that you are indeed in your habitation directory, type the cd (alter directory) control past itself. This moves you to your home (default) directory. And then type the pwd (print working directory) control to brandish your electric current location within the filesystem. The directory displayed is your home directory:

$                          cd                        $                          pwd                        /export/home/username          

In this example, the user'south abode directory is /export/home/ username, where username is the name of the user owning the dwelling house directory.

3.ii.2 Creating a Test File

Employ the touch on command to create an empty file. If a file by the name yous specify doesn't already exist, the affect control creates an empty file (if the file already exists, touch updates the last file access time).

iii.ii.3 Listing Files (ls)

Now list the file with the ls command to verify that you've created it:

When you enter the ls command by itself, it lists all the files in your electric current location. If y'all enter the ls command with a specific file name, it lists but that file, if the file exists.

For more data on the ls(1) command, refer to the homo Pages(1): User Commands.

iii.2.4 Copying Files (cp)

Use the cp command to copy tempfile to a file chosen copyfile:

Now effort listing both files. Notice that both names end with the characters "file." You tin use the wildcard graphic symbol, asterisk (*), to represent whatever graphic symbol or sequence of characters. Therefore, the control ls *file should list both tempfile and copyfile (and whatever other file in this directory with a name that ends with file):

$                          ls *file                        copyfile    tempfile

Notice that copyfile is listed first. Files are listed in alphabetical guild. (Capital letter letters and numbers precede lowercase letters.)

For detailed information on the cp(one) command, refer to the man Pages(1): User Commands.

3.ii.5 Moving and Renaming Files (mv)

You can both move and rename files using the same command, mv (motion). In this instance, utilise the mv command to rename tempfile to emptyfile:

$                          mv tempfile emptyfile                        $          

Now list both files again to verify the change:

$                          ls *file                        copyfile    emptyfile

Every bit you lot can meet, tempfile is replaced past emptyfile.

For more information on the mv(ane) command, refer to the man Pages(1): User Commands.

3.2.half-dozen Deleting Files (rm)

Finally, apply the rm (remove) command to delete copyfile, and verify the result with the ls command:

$                          rm copyfile                        $                          ls *file                        emptyfile

Caution - Caution -

Once you delete a file, it is gone for good. Unless there is a backup re-create, the file cannot exist restored. Be careful when using the rm command, and be particularly careful when using rm with the wildcard character (*). Files removed with rm cannot be recovered.


For more detailed information on the rm(1) control, refer to the man Pages(ane): User Commands.

3.2.seven Displaying File Contents (more, cat)

Utilise the more command to display the contents of a file. Type more than followed by the name of the file to exist displayed. The contents of the file scrolls downward the screen. If the file is longer than i screen, this bulletin appears:

--More--(nn%)  [Printing infinite to go along, `q' to quit.]

where nn is the percentage of the file already displayed.

You can as well use the cat command to display the contents of a file, simply information technology flashes through the unabridged file chop-chop without pausing. The true cat (concatenate) command is more than oft used to join two or more files into one large file, every bit in this case:

$                          cat file1 file2 file3 > bigfile                        $                          ls *file                        bigfile file1 file2 file3 $

For farther information on the more(1) or cat(one) commands, refer to the homo Pages(1): User Commands.

3.2.eight Displaying File Type (file)

Some files, such as binary files and executable files, are not printable and cannot be displayed on the screen. The file command tin can be handy if you're not sure of the file type.

Utilize the file command to evidence the file type:

$                          file copyfile                        copyfile:    ascii text          

3.3 Directories and Hierarchy

Past now you know how to list, copy, rename, and delete files. However, you may exist wondering about larger issues. Where are these files located? This section discusses the directory hierarchy. Read the following narrative carefully, and then attempt the examples in the sections that follow.

3.3.1 Directory Hierarchy

Files are grouped into directories, which are themselves organized in a bureaucracy. At the top of the hierarchy is the "root" directory, symbolized by "/".

Equally shown in the following example, Figure 3-1, each directory in the file system can have many directories within it. The convention is to distinguish directory levels with the / character. With this in mind, notice that the directory / (root) contains the subdirectories /usr, /bin, /home and /lib, among others. The subdirectory /abode contains user1, user2, and user3.

Y'all specify directories (and files inside them) by including the names of the directories they're in. This is called a path name. For example, the path name for the user3 directory in the illustration above is /home/user3.

Figure 3-1 File Organisation Hierarchy

Graphic

All subdirectory and file names within a directory must be unique. However, names within different directories can be the same. For case, the directory /usr contains the subdirectory /usr/lib. In that location is no disharmonize between /usr/lib and /lib considering the path names are different.

Path names for files work exactly similar path names for directories. The path name of a file describes that file's place within the file system hierarchy. For example, if the /dwelling/user2 directory contains a file called report5, the path proper name for this file is /home/user2/report5. This shows that the file report5 is within the directory user2, which is within the directory home, which is within the root (/) directory.

Directories can contain but subdirectories, only files, or both.

3.3.2 Print Working Directory (pwd)

The control pwd (print working directory) tells you lot where you are in the file system hierarchy:

Your output will look somewhat different from that in the example, as your directory structure will be different. Remember that your working directory is your current location within the file system hierarchy.

iii.3.three Your Dwelling house Directory

Every user has a home directory. When you first open the Command Tool or Shell Tool window in the OpenWindows environment, your initial location (working directory) is your home directory. This directory is established for you past the system administrator when your account is created.

3.3.4 Modify Working Directory (cd)

The cd (change directory) command allows yous to move effectually within the file system hierarchy:

$                          cd /usr/lib                        $                          pwd                        /usr/lib

When you type the cd command by itself, yous return to your home directory. For instance, if your habitation directory was /home/user1:

In the C crush, the tilde (~) is used as a shortcut for specifying your home directory. For example, you lot would type the following to change to the subdirectory music within your dwelling directory:

Yous can besides utilize this shortcut to specify another user's dwelling house directory. For example:

where username is another user's login name, would change to that user's dwelling house directory.


Annotation -

If y'all are using the Bourne crush, the ~ shortcut volition not work.


If you are using the Bourne shell, information technology may be possible that your organisation administrator has configured the system and then that you can type $home to specify your home directory. If this is the case, then typing:

changes you to the subdirectory music in your home directory. Also, typing:

changes you to the specified user'south abode directory, where username represents another user's login proper noun.

The directory immediately "above" a subdirectory is called the parent directory. In the preceding example, /home is the parent directory of /abode/user1. The symbol .. ("dot-dot") represents the parent directory. Therefore, the command cd .. changes the working directory to the parent directory, as in this example:

$                          pwd                        /home/user1 $                          cd ..                        $                          pwd                        /home

Suppose your current working directory is /home/user1 and y'all desire to work with some files in /home/user2. Hither is a useful shortcut:

$                          pwd                        /home/user1 $                          cd ../user2                        $                          pwd                        /home/user2

../user2 tells the system to await in the parent directory for user2. As you can see, this is much easier than typing the unabridged path proper name /dwelling house/user2.

three.3.5 Creating a Directory (mkdir)

It is easy to create a new directory. Type the mkdir command followed by the name of the new directory:

$                          mkdir veggies                        $                          cd veggies                        $                          mkdir broccoli                        $                          cd broccoli                        $                          pwd                        /home/user2/veggies/broccoli

iii.three.6 Relative Path Names

The full path proper noun of a directory or a file begins with a slash (/) and describes the unabridged directory structure betwixt that file (or directory) and the root directory. Nonetheless, y'all can often employ a much shorter name which defines the file or directory relative to the current working directory.

When yous are in a parent directory, you tin can move to a subdirectory using only the directory name and not the full path name. In the previous example, the control cd veggies uses the relative path proper name of the directory veggies. If the current working directory is /home/user2, the full path proper noun of this directory is /home/user2/veggies.

Attempt creating several different subdirectories, and then move around within this directory structure. Use both total path names and relative path names, and confirm your location with the pwd command.

3.3.7 Moving and Renaming Directories

You rename a directory by moving information technology to a unlike name. Utilise the mv command to rename directories:

$                          pwd                        /home/user2/veggies $                          ls                        broccoli $                          mv broccoli carrots                        $                          ls                        carrots

Y'all can also use mv to move a directory to a location within another directory:

$                          pwd                        /home/user2/veggies $                          ls                        carrots $                          mv carrots ../veggies2                        $                          ls ../veggies2                        carrots

In this instance, the directory carrots is moved from veggies to veggies2 with the mv command.

iii.iii.8 Copying Directories

Use the cp -r command to re-create directories and the files they comprise:

$                          cp -r veggies veggies3                        $

This control copies all files and subdirectories within the directory veggies to a new directory veggies3. This is a recursive re-create, equally designated by the -r option. If you effort to copy a directory without using this option, you will see an error message.

three.three.nine Removing Directories (rmdir)

To remove an empty directory, apply the rmdir command as follows:

If the directory nevertheless contains files or subdirectories, the rmdir command will not remove the directory.

Utilise rm -r (adding the recursive option -r to the rm command) to remove a directory and all its contents, including whatever subdirectories and their files, every bit follows:


Caution - Caution -

Directories removed with the rmdir command cannot exist recovered, nor tin can directories and their contents removed with the rm -r control.


iii.four Looking at Differences Betwixt Files (diff)

Information technology frequently happens that different people with access to a file make copies of the file then edit their copies. diff will show you the specific differences between versions of an ASCII file. The command:

$                          diff leftfile rightfile                      

scans each line in leftfile and rightfile looking for differences. When it finds a line (or lines) that differ, it determines whether the deviation is the result of an addition, a deletion, or a change to the line, and how many lines are affected. It tells y'all the respective line number(s) in each file, followed by the relevant text from each.

If the difference is the result of an improver, unequal displays a line of the form:

where l is a line number in leftfile and r is a line number in rightfile.

If the difference is the event of a deletion, diff uses a d in place of a; if it is the outcome of a alter on the line, diff uses a c.

The relevant lines from both files immediately follow the line number data. Text from leftfile is preceded by a left angle bracket (<). Text from rightfile is preceded by a correct angle subclass (>).

This instance shows 2 sample files, followed by their diff output:

$                              cat sched.seven.15                        Week of 7/15  Mean solar day:  Time:        Action Particular:          Details:  T     10:00        Hardware mtg.         every other calendar week Due west     one:30         Software mtg. T     3:00         Docs. mtg. F     one:00         Interview $                          cat sched.7.22                        Calendar week of 7/22  Day:  Time:        Action Particular:          Details:  G     eight:thirty         Staff mtg.            all day T     10:00        Hardware mtg.         every other week Due west     1:30         Software mtg. T     3:00         Docs. mtg. $                          unequal sched.7.fifteen sched.7.22                        1c1 < Calendar week of vii/15 --- > Week of vii/22 4a5 > M     eight:30         Staff mtg.            all day 8d8 < F     1:00         Interview

If the 2 files to exist compared are identical, there is no output from diff.

The diff(ane)control has many more options than those discussed here. For more information, refer to the man Pages(one): User Commands.

3.4.ane Comparison Iii Different Files (diff3)

If you lot have 3 versions of a file that y'all want to compare at one time, use the diff3 command as follows:

$ diff3            file1            file2            file3          

diff3 compares three versions of a file and publishes disagreeing ranges of text flagged with these codes:

==== all iii files differ

====1 file1 is dissimilar

====2 file2 is dissimilar

====three file3 is different

3.4.two Using bdiff on Big Files

If you are comparison very big files, use bdiff instead of diff. Both programs work in a like manner:

$                          bdiff leftfile rightfile                      

Use bdiff instead of diff for files longer than 3500 lines or so.

three.five Looking Up Files (find)

The find command searches for files that come across conditions you lot specify, starting from a directory you name. For example, y'all might search for filenames that match a sure pattern or that take been modified within a specified time frame.

Different most commands, find options are several characters long, and the proper name of the starting directory must precede them on the control line as follows:

where directory is the name of the starting directory and options represents the options for the find control.

Each option describes a benchmark for selecting a file. A file must run into all criteria to be selected. Thus, the more options you employ, the narrower the field becomes. The -print option indicates that you want the results to be displayed. (As described afterwards on, you tin use detect to run commands. You may want find to omit the display of selected files in that case.)

The -name filename selection tells find to select files that match filename. Hither filename is taken to be the rightmost component of a file's full path name. For example, the rightmost component of the file /usr/lib/agenda is calendar. This portion of a file'south name is often chosen its base name.

For case, to see which files within the current directory and its subdirectories end in s, type:

$                          find . -name '*s' -impress                        ./programs ./programs/graphics ./programs/graphics/gks ./src/gks $

Other options include:

-name filename

Selects files whose rightmost component matches filename. Surroundings filename with single quotes if it includes filename substitution patterns.

-user userid

Selects files endemic by userid. userid can exist either a login proper name or user ID number.

-grouping grouping

Selects files belonging to group.

-yard -fourth dimension n

Selects files that have been modified within n days.

-newer checkfile

Selects files modified more recently than checkfile.

You can specify an order of precedence by combining options within (escaped) parentheses (for example, \(options\) ). Within escaped parentheses, y'all can use the -o flag between options to indicate that find should select files that qualify nether either category, rather than simply those files that qualify under both categories:

$                          detect . \( -proper name AAA -o -name BBB \) -print                        ./AAA ./BBB

You can invert the sense of an pick by prepending an escaped exclamation betoken. find then selects files for which the option does not apply:

$                          find . \!-name BBB -print                        ./AAA

You tin likewise use find to employ commands to the files it selects with the

-exec command '{}' \;

selection. This pick is terminated with an escaped semicolon (\;). The quoted braces are replaced with the filenames that observe selects.

As an example, you can apply discover to automatically remove temporary work files. If you proper noun your temporary files consistently, you tin can utilize observe to seek them out and destroy them wherever they lurk. For example, if y'all name your temporary files junk or dummy, this command will discover them and remove them:

$                          find . \( -name junk -o -proper noun dummy \) -exec rm '{}' \;                      

For more information on find(1), refer to the human being Pages(1): User Commands.

3.6 File and Directory Security


Note -

Read this section carefully. A clear understanding of file permissions is oftentimes important in day-to-day piece of work.


File permissions aid to protect files and directories from unauthorized reading and writing. Oft you will have files you wish to let others to read but not change. In other cases, yous may take executable files (programs) to share. File permissions allow you to control access to your files.

These are the basic file and directory permission types:

  • r - read permission. A file must be readable to exist examined or copied. A directory must be readable for you to listing its contents.

  • westward - write permission. A file must be writable in guild for y'all to modify it, remove it, or rename information technology. A directory must be writable in gild for you to add or delete files in it.

  • x - execute permission. A file with executable permissions is one y'all can run, such as a programme. A directory must be executable for you to gain access to whatever of its subdirectories.

There are 3 categories of users for which you can set permissions:

  • Cocky - The user

  • Group - Other users within the same group as the user (for example, all bookkeeping users). Groups are established and maintained by the system administrator.

  • Others - Everyone else

three.6.1 Displaying Permissions and Status (su ls -l )

You have already used the ls command to list files. The ls command has many options. Use the -50 option to display a long format list. Files and directories are listed in alphabetical lodge. Figure 3-2 illustrates this method for displaying files:

Figure 3-2 Displaying Permissions and Status

Graphic

The very starting time character on the line indicates the file type. A dash (-) is an ordinary file; a d indicates a directory, and other characters can betoken other special file types.

The adjacent nine characters indicate the permissions for the file or directory. The 9 characters consist of three groups of three, showing the permissions for the owner, the owner's group, and the world, respectively. The permissions for emptyfile are rw-r--r--, indicating that the owner can read and write this file, everyone can read it, and no 1 tin execute information technology. The permissions for the directory veggies2 are rwxr-xr-ten, indicating that everyone has read and execute permissions, merely only the owner can write to it.

In addition to file permissions, the display shows the following data:

  • Number of links to this file or directory

  • Name of the owner (user2 in this instance)

  • Number of bytes (characters) in the file

  • Date and time the file or directory was last updated

  • Proper noun of the file or directory

    Employ the cd control to move to your dwelling directory, and attempt the ls -l control. Your results volition differ from the example, of course.

    At present attempt typing a command such equally the post-obit:

where dirname is the name of an actual directory inside your file system. When you requite the name of a directory, the ls -l command prints information on all the files and directories (if any) inside that directory.

3.6.2 Listing "Hidden" Files (ls -a )

At that place are some files that are not listed by the ordinary ls command. These files take names starting time with the grapheme . (chosen "dot"), such as .cshrc, .login and .profile. Use the ls -a control to list these dot files:

$                          ls -a                        . .. .cshrc .login .profile emptyfile

Notice that the files beginning with . are listed before the other files. There are two special files in this listing: the file .is the reference for the current directory, and the file .. is the reference for the parent directory.

Generally speaking, files that begin with . are used past system utilities and are not normally modified past the user. At that place are a few exceptions to this.

three.six.3 Changing Permissions (chmod)

Use the chmod control to change permissions for a file or directory. Yous must be the owner of a file or directory, or have root access, to alter its permissions. The full general class of the chmod command is:

where permissions indicates the permissions to be changed and proper name is the name of the affected file or directory.

The permissions can be specified in several ways. Here is 1 of the forms which is easiest to use:

  1. Use 1 or more messages indicating the users involved:

    • u (for the user)

    • yard (for group)

    • o (for others)

    • a (for all iii of the above categories)

  2. Indicate whether the permissions are to be added (+) or removed (-).

  3. Use one or more letters indicating the permissions involved:

    • r (for read)

    • w (for write)

    • ten (for execute)

In the following example, write permission is added to the directory carrots for users belonging to the same group (thus, permissions is g+w and name is carrots):

$                          ls -l carrots                        drwxr-xr-x  three user2           1024 February 10 11:15 carrots $                          chmod k+w carrots                        $                          ls -fifty carrots                        drwxrwxr-x  3 user2           1024 February 10 11:15 carrots $

As you can see, the hyphen (-) in the prepare of characters for group is changed to a due west as a result of this command.

To make this same directory unreadable and unexecutable past other users outside your grouping (permissions is o-rx), y'all would enter the following:

$                          ls -l carrots                        drwxrwxr-ten  three user2           1024 February 10 11:15 carrots $                          chmod o-rx carrots                        $                          ls -l carrots                        drwxrwx---  three user2           1024 February 10 11:fifteen carrots $

At present, the r (for read) and the x (for execute) in the ready of characters for other users are both inverse to hyphens (-).

When you lot create a new file or directory, the system automatically assigns permissions.

In general, the default settings for new files are:

-rw-r--r--

and for new directories are:

drwxr-xr-x

So, to make a new file turnip executable by its owner (user2), you would enter the following:

$                              ls -50 turnip                        -rw-r--r--  3 user2           1024 Feb x 12:27 turnip $                          chmod u+x turnip                        $                          ls -l turnip                        -rwxr--r--  iii user2           1024 February 10 12:27 turnip $

If you desire to impact all iii categories of users at once, use the -a option. To brand a new file garlic executable by everyone, yous would enter the following:

$                              ls -l garlic                        -rw-r--r--  3 user2           1024 Feb 10 eleven:31 garlic $                          chmod a+x garlic                        $                          ls -l garlic                        -rwxr-xr-x  3 user2           1024 Feb 10 11:31 garlic $

Equally a issue, the ten indicator appears in all three categories.

You can besides modify permissions for groups of files and directories using the * wildcard graphic symbol. For case, y'all would enter the post-obit to change the permissions for all the files in the electric current directory veggies so that the files can be written past you alone:

$                          pwd                        /abode/user2/veggies $                              ls -50                        -rwxrwxrwx  3 user2          21032 Feb 12 ten:31 beats -rwxrwxrwx  two user2             68 February 10 11:09 corn -rwxrwxrwx  three user2          12675 Feb 08 09:31 garlic -rwxrwxrwx  ane user2           1024 Feb 14 sixteen:38 onions $                          chmod go-due west *                        $                          ls -fifty                        -rwxr-xr-x  3 user2          21032 Feb 12 10:31 beats -rwxr-xr-x  two user2             68 Feb 10 11:09 corn -rwxr-xr-x  3 user2          12675 February 08 09:31 garlic -rwxr-xr-x  i user2           1024 Feb 14 16:38 onions $

The pwd command is included in this example to illustrate that the directory on which yous perform this chmod functioning must be the current directory.

3.vi.4 Setting Absolute Permissions

Upwards to this betoken, the discussion on permissions has only included using the chmod command to modify permissions relative to their current settings. Using a different class of the chmod control, which applies numeric codes to specify permissions, you tin can set the permissions for a file or directory absolutely.

The syntax for this usage of the chmod command is:

chmod numcode name

where numcode is the numeric code and proper noun is the name of the file or directory for which you lot are irresolute permissions.

The complete numeric code consists of three numbers. One number is used for each of the three categories: user, group, and others. For example the following command sets absolute read, write, and execute permissions for the user and the group, and execute permissions just for others:

Tabular array 3-1 illustrates how the permissions described for garlic are represented by the code 771.

Table 3-1 Permissions for garlic

Permission

User

Grouping

Others

Read

iv

4

0

Write

2

2

0

Execute

1

i

1

Total

7

seven

ane

Each of the columns in Tabular array 3-1 represents one of the categories: user, group, and others. To set read permissions, you add 4 to the appropriate column. To set write permissions, yous add ii. To add execute permissions, you add 1. The total in all three columns in the last row of the table is the complete numeric code.

The post-obit is another instance of this method for setting absolute permissions, with the ls -l control included to demonstrate the results:

$                              ls -50 onion                        -rw-r--r--  three user2           1024 Feb 10 11:46 onion $                          chmod 755 onion                        $                          ls -fifty onion                        -rwxr-xr-x  3 user2           1024 Feb x 11:48 onion $

The permissions for the file onion are set then that the user can read, write, and execute; group members tin can read and execute; and others can also read and execute. Table iii-ii provides the breakdown of the numeric code used to set the permissions for onion.

Table 3-two Permissions for onion

Permission

User

Group

Others

Read

4

iv

4

Write

2

0

0

Execute

1

ane

ane

Total

vii

5

5

Of form, to provide read, write, and execute permissions for the file cabbage to yourself, your group, and all other users, you would enter the post-obit:

$                              ls -l cabbage                        -rw-r--r--  three user2           1024 Feb 10 eleven:51 cabbage $                          chmod 777 cabbage                        $                          ls -fifty cabbage                        -rwxrwxrwx  3 user2           1024 Feb 10 eleven:53 cabbage $

Table iii-3 provides the breakdown for this example.

Table 3-3 Permissions for cabbage

Permission

User

Group

Others

Read

four

4

4

Write

two

ii

2

Execute

1

1

1

Full

7

7

7

The numeric code 777 represents the maximum level of permissions you can provide.

Similar to irresolute relative permissions, you can also utilize the wildcard grapheme * to set absolute permissions for all in the files in the current directory. For example, to set accented permissions for all files in the current directory veggies and so that you have read, write, and execute permissions; your grouping has read and execute permissions; and all other users take execute permissions simply, you would enter the post-obit:

$                          pwd                        /dwelling/user2/veggies $                              ls -l                        -rwxrwxrwx  iii user2          21032 Feb 12 x:31 beats -rwxrwxrwx  2 user2             68 Feb 10 11:09 corn -rwxrwxrwx  3 user2          12675 Feb 08 09:31 garlic -rwxrwxrwx  ane user2           1024 February 14 16:38 onions $                          chmod 751 *                        $                          ls -fifty                        -rwxr-x--ten  3 user2          21032 Feb 12 10:31 beats -rwxr-x--x  2 user2             68 Feb 10 11:09 corn -rwxr-ten--x  3 user2          12675 Feb 08 09:31 garlic -rwxr-x--x  1 user2           1024 Feb 14 16:38 onions $

The pwd command is included in this instance to illustrate that the directory on which y'all perform this operation must be the current directory. The ls -50 command is shown only to illustrate the changes in permissions. When setting accented permissions, information technology'due south not necessary to know what the permissions are currently.

For more information on the chmod(ane) command, refer to the homo Pages(i): User Commands.

uriaswasped82.blogspot.com

Source: https://docs.oracle.com/cd/E19455-01/806-2902/6jc3b36d5/index.html

0 Response to "Bash if Result Empty Try Again 3 Times"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel