Sponsored Content
Top Forums Shell Programming and Scripting file permissions using shell scripting Post 302138525 by barbus on Tuesday 2nd of October 2007 06:39:14 AM
Old 10-02-2007
i assume he is doing this, because he wants me to grasp some concepts, he did say i can use sed and awk once am confirtable doing stuff without them Smilie

i have only being using unix for about 2 weeks now after all.

can we get to the problem in hand please Smilie

Quote:
is it possible to redirect the string of permissions like rwxr-wr-- to a variable/tmp?
and can the find function be used to display something like the 1st string of 10 characters from a line?

Last edited by barbus; 10-02-2007 at 07:53 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

file activity (open/closed) file descriptor info using KORN shell scripting

I am trying to find a way to check the current status of a file. Such as some cron job processes are dependent on the completion of others. if a file is currently being accessed / modified or simply open state I will wait until it is done being processed before attempting the next process on that... (3 Replies)
Discussion started by: Gary Dunn
3 Replies

2. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

3. Shell Programming and Scripting

.def file in HP-UX Shell scripting

Hi Pals, I need some information related .def file in HP-Ux shell scripting. What actaully a .def file contains. It is having all definitions of some functions. But what is the relationship between a .def file and shell script. Can anyone give some examples. Thanks in Advance. Best... (1 Reply)
Discussion started by: manu.vmr
1 Replies

4. Shell Programming and Scripting

file operations in shell scripting

hi All, my query... 1.I Have to search for the files in the root directory. 2.i have to search for a pattern in all the files in the root directory and then replace them with a new pattern. 3.Rename the file Explanation: if ABC is the root folder and has 3 subfolders and there are 15... (9 Replies)
Discussion started by: adityamahi
9 Replies

5. Shell Programming and Scripting

Shell scripting - need to arrange the columns from multiple file into a single file

Hi friends please help me on below, i have 5 files like below file1 is x 10 y 20 z 15 file2 is x 100 z 245 file3 is y 78 z 23 file4 is x 100 (3 Replies)
Discussion started by: siva kumar
3 Replies

6. Homework & Coursework Questions

Shell scripting/working with a file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1. Write a shell script that will work with a file from the command line. The program should: a. Check... (4 Replies)
Discussion started by: Jagst3r21
4 Replies

7. Programming

To check the file permissions using python scripting

Hi, For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755. Am able to check this using the statement: "if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):" But the problem here... (0 Replies)
Discussion started by: arjun_arippa
0 Replies

8. Shell Programming and Scripting

To check the file permissions using python scripting

Hi, For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755. Am able to check this using the statement: "if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):" But the problem... (1 Reply)
Discussion started by: arjun_arippa
1 Replies

9. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

10. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies
umask(1)						      General Commands Manual							  umask(1)

NAME
umask - set or display the file mode creation mask SYNOPSIS
Set Mask Display Mask DESCRIPTION
The command sets the value of the file mode creation mask or displays the current one. The mask affects the initial value of the file mode (permission) bits for subsequently created files. Setting the File Mode Creation Mask The command sets a new file mode creation mask for the current shell execution environment. mask can be a symbolic or numeric (obsoles- cent) value. A symbolic mask provides a flexible way of modifying the mask permission bits individually or as a group. A numeric mask specifies all the permission bits at one time. When a mask is specified, no output is written to standard output. A symbolic mask replaces or modifies the current file mode creation mask. It is specified as a comma-separated list of operations in the following format. Whitespace is not permitted. [who][operator][permissions][, ...] The fields can have the following values: who One or more of the following letters: Modify permissions for user (owner). Modify permissions for group. Modify permissions for others. Or: Modify permissions for all = operator One of the following symbols: Add permissions to the existing mask for who. Delete permissions from the existing mask for who. Replace the existing mask for who with permissions. permissions One or more of the following letters: The read permission. The write permission. The execute/search permission. If one or two of the fields are omitted, the following table applies: | Format Entered Effect | Input Equals ---------------------------------------------------------+---------------- who Delete current permissions for who | operator No action | (none) permissions Equal to: | Delete current permissions for who | No action | (none) No action | (none) whopermissions Equal to: | operatorpermissions Equal to: | A numeric mask replaces the current file mode creation mask. It is specified as an unsigned octal integer, constructed from the logical OR (sum) of the following mode bits (leading zeros can be omitted): Displaying the Current Mask Value To display the current file mode creation mask value, use one of the commands: Print the current file mode creation mask in a symbolic format: The characters (read), (write), and (execute/search) represent the bits that are clear in the mask for (user/owner), (group), and (other). All other bits are set. Print the current file mode creation mask as an octal value. The zero bits in the numeric value correspond to the displayed and permission characters in the symbolic value. The one bits in the numeric value correspond to the missing permission characters in the symbolic value. Depending on implementation, the display consists of one to four octal digits; the first digit is always zero (see DEPENDENCIES). The rightmost three digits (leading zeros implied as needed) represent the bits that are set or clear in the mask. Both forms produce output that can be used as the mask argument to set the mask in a subsequent command. General Operation When a new file is created (see creat(2)), each bit that is set in the file mode creation mask causes the corresponding permission bit in the the file mode to be cleared (disabled). Conversely, bits that are clear in the mask allow the corresponding file mode bits to be enabled in newly created files. For example, the mask (octal disables group and other write permissions. As a result, files normally created with a file mode shown by the command as (octal become mode (octal while files created with file mode (octal become mode (octal Note that the file creation mode mask does not affect the set-user-id, set-group-id, or "sticky" bits. The file creation mode mask is also used by the command (see chmod(1)). Since affects the current shell execution environment, it is generally provided as a shell regular built-in (see DEPENDENCIES). If is called in a subshell or separate utility execution environment, such as one of the following: it does not affect the file mode creation mask of the calling environment. The default mask is (octal RETURN VALUE
exits with one of the following values: The file mode creation mask was successfully changed or no mask operand was supplied. An error occurred. EXAMPLES
In these examples, each line show an alternate way of accomplishing the same task. Set the value to produce read and write permissions for the file's owner and read permissions for all others displays on newly created files): Set the value to produce read, and write permissions for the file's owner, read-only for others users in the same group, and no access to others Set the value to deny read, write, and execute permissions to everyone Add the write permission to the current mask for everyone (there is no equivalent numeric mode): WARNINGS
If you set a mask that prevents read or write access for the user (owner), many programs, such as editors, that create temporary files will fail because they cannot access the file data. DEPENDENCIES
The command is implemented both as a separate executable file and as built-in shell commands. POSIX Shell and Separate File All features are supported (see sh-posix(1)). The numeric mask display uses a minimum of two digits. Korn Shell The option is not supported in the Korn shell built-in command (see ksh(1)). The numeric mask display uses a minimum of two digits. C Shell The option and symbolic mask values are not supported in the C shell built-in command (see csh(1)). The numeric mask display uses a mini- mum of one digit. SEE ALSO
chmod(1), csh(1), ksh(1), sh-posix(1), sh(1), chmod(2), creat(2), umask(2). STANDARDS CONFORMANCE
umask(1)
All times are GMT -4. The time now is 05:18 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy