Skip to content
Advertisement

Tag: shell

Preserve timestamp when editing file

I want to preserve the timestamp of the files I’m editing in a for loop The issue is I need to get a formatted date string from the file so that I can do touch -r to revert the files date back once the loop has completed. stat is not giving the me the format I need. Required Format: YYMMDDhhmm

Shell bash script does not run R

I have an R script that I can run with and it successfully returns the results to a.txt. I am attempting to write a new shell script that plan to run daily, and have made the following script, called morning I run this with the following commands I can get this to work sort of, but end up with the

Newbie-ish error: cp: omitting directory

Pulling my hair as I’m stuck with a basic error without understanding why: We’re in a “test” directory, in which I created one “del” subdirectory. The “test” directory contains a variety of files of various types. The result is a series of lines (same number as the number of files present in the directory from where the command is ran)

Issue finding the process id from shell scipt

mySample.sh The above command is printing and killing the temporary process that was created for grep Even though i do not have any process running with Abcd, This is printing pid Any ways to ignore it, iam actually ignoring it using grep -v, still… Any Issue in fetching the process id.? Basic command line output is below,After running a process

bash does not get root permissions with setuid program

I have the following home-grown implementation of su: To allow for proper execution, the permissions and ownership information are set accordingly: When I invoke a shell, such as /bin/sh, I am able to modify root-owned files and directories: However, /bin/bash doesn’t seem to get root permissions: Answer Shells reset the euid to the uid for security reasons. So if you

set line-increment in nl command to a float number

I want to use nl command to do numbering for lines. Is it possible to set line-increment in nl command to a float number. I know that we cant use -i switch to set line-increment like this: but it doesn’t work for float numbers like: I want the output to be like this Answer Could use awk instead With padding

Advertisement