Sponsored Content
Full Discussion: Function explanation
Top Forums UNIX for Beginners Questions & Answers Function explanation Post 303043530 by Chubler_XL on Thursday 30th of January 2020 04:47:52 PM
Old 01-30-2020
This function is quite well commented, it basically uses the tail command to print the last MAX_LENGTH ($2) lines of FILE ($1) these are stored in a temporary file (name generated by the mktmp command) the contents of this temporary file is then copied back over the original file and the temporary file removed.
All the operations performed are checked to ensure they have a success exit code before moving onto the next step.

Which particular part of the function you are having trouble understanding?
This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

tr explanation please

how does below tr command replace nonletters with newlines? I think I understand tr -cs '\n' part.. but what is A-Za-z\' <--- what is this?? tr -cs A-Za-z\' '\n' | -c --complement -s, --squeeze-repeats replace each input sequence of a repeated character that is... (0 Replies)
Discussion started by: convenientstore
0 Replies

2. Shell Programming and Scripting

tr explanation please

how does below tr command replace nonletters with newlines? I think I understand tr -cs '\n' part.. but what is A-Za-z\' <--- what is this?? tr -cs A-Za-z\' '\n' | -c --complement -s, --squeeze-repeats replace each input sequence of a repeated character that is... (1 Reply)
Discussion started by: convenientstore
1 Replies

3. UNIX and Linux Applications

need explanation

Hi am having a c pgm. It has the include files (unistd.h,sys/types.h,win.h,scr.h,curses.h,stdarg.h and color.h). I don't know the purpose of these include files. will u plz explain me. (1 Reply)
Discussion started by: Mari.kb
1 Replies

4. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies

5. UNIX for Dummies Questions & Answers

In need of explanation

Its great someone provided this script that strips out a filename and extension but can someone explain how each line works? file1='Jane Mid Doe.txt' newfile='Jane.txt' 1) ext=${file1##*.} 2) filename=${file%%.???} 3) set -- $filename 4) newfile="1.$extension" (1 Reply)
Discussion started by: Lillyt
1 Replies

6. Shell Programming and Scripting

explanation of test function

I have found a code some where, which looks like if (test $value) then <do something> fi I am not understanding what is test doing here. I have seen test with !,-eq, -e etc. But, the above appears to be a new one to me. Can anyone please expalin me. (4 Replies)
Discussion started by: mady135
4 Replies

7. UNIX for Dummies Questions & Answers

Explanation on problem "match" function awk

Hello Unix experts, If I could get any explanations on why the code below doesn't work it would be great ! My input looks like that ("|" delimited): Saaaaabbbbbccccc|ok Sdddddfffffggggg|ok The goal is, if $2 is "ok", to remove everything before the pattern given in the match function... (5 Replies)
Discussion started by: lucasvs
5 Replies

8. Shell Programming and Scripting

Need explanation

Hi, I need more explination on it, how it works abcd="$(echo "$abcd" | sed 's/ //g')" >> ${LOGFILE} 2>&1 can any one suggest me on this? Rgds, LKR (1 Reply)
Discussion started by: lakshmanraok
1 Replies

9. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

10. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies
SYSTEMD-TMPFILES(8)						 systemd-tmpfiles					       SYSTEMD-TMPFILES(8)

NAME
systemd-tmpfiles, systemd-tmpfiles-setup.service, systemd-tmpfiles-setup-dev.service, systemd-tmpfiles-clean.service, systemd-tmpfiles- clean.timer - Creates, deletes and cleans up volatile and temporary files and directories SYNOPSIS
systemd-tmpfiles [OPTIONS...] [CONFIGFILE...] systemd-tmpfiles-setup.service systemd-tmpfiles-setup-dev.service systemd-tmpfiles-clean.service systemd-tmpfiles-clean.timer DESCRIPTION
systemd-tmpfiles creates, deletes, and cleans up volatile and temporary files and directories, based on the configuration file format and location specified in tmpfiles.d(5). If invoked with no arguments, it applies all directives from all configuration files. If one or more filenames are passed on the command line, only the directives in these files are applied. If only the basename of a configuration file is specified, all configuration directories as specified in tmpfiles.d(5) are searched for a matching file. OPTIONS
The following options are understood: --create If this option is passed, all files and directories marked with f, F, w, d, D, p, L, c, b, m in the configuration files are created or written to. Files and directories marked with z, Z, m have their ownership, access mode and security labels set. --clean If this option is passed, all files and directories with an age parameter configured will be cleaned up. --remove If this option is passed, all files and directories marked with r, R in the configuration files are removed. --boot Also execute lines with an exclamation mark. --prefix=PATH Only apply rules that apply to paths with the specified prefix. This option can be specified multiple times. --exclude-prefix=PATH Ignore rules that apply to paths with the specified prefix. This option can be specified multiple times. --help Prints a short help text and exits. It is possible to combine --create, --clean, and --remove in one invocation. For example, during boot the following command line is executed to ensure that all temporary and volatile directories are removed and created according to the configuration file: systemd-tmpfiles --remove --create EXIT STATUS
On success, 0 is returned, a non-zero failure code otherwise. SEE ALSO
systemd(1), tmpfiles.d(5) systemd 208 SYSTEMD-TMPFILES(8)
All times are GMT -4. The time now is 09:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy