Tagged: unix

About linux : Remove-and-zip-files-in-directories

Question Detail #! /usr/bin/bash DIRECTORY=/main/dir/sub-dir if [ -d $DIRECTORY ]; then find $DIRECTORY/ ‘*’ -maxdepth 1 -mtime +1 -exec rm -rf {} \;; #Zip Files generated within the last six hour find $DIRECTORY/ ‘*’...

About c : lock-file-on-linux-and-if-lock-successful-become-daemon

Question Detail I want to write program that becomes daemon on demand: if_there_are_no_daemon_alive_start_daemon(); pass_job_to_daemon(); and I stuck on implementation of if_there_are_no_daemon_alive_start_daemon. At first I think of trying to lock file /run/lock/my-unique-name.lck, and if succeeded...

About linux : Why-the-multiple-read-commands-giving-me-errors

Question Detail #!/bin/bash # your code goes here echo “1.Addition 2.Subtraction 3.Multiplication 4.Division” read n echo “Enter the operends” read a read b case $n in “1”) echo “$a+$b =`expr $a \ + $b`”;;...

About linux : grep-ignore-string-inside-parenthesis

Question Detail Here is my input: (ALL) ALL (root) ALL,!/bin/sh,!/bin/ksh,!/bin/csh (ALL) NOPASSWD: ALL (ALL) NOPASSWD: EMC_LTH (ALL) NOPASSWD: ALL (ALL) ALL (ALL) NOPASSWD: ALL (ALL) NOPASSWD: /usr/sbin/dmidecode NOPASSWD: ALL,!/usr/bin/rm,!/bin/rm (ALL) NOPASSWD: /usr/bin/passwd root I...