Posts

Showing posts from August 20, 2018

how to make two scripts in sed. one after the other

Image
Clash Royale CLAN TAG #URR8PPP up vote 0 down vote favorite How can we use a file to make a script in sed and then using that script again to translate the text? For example, if we have a morse code file to be translated in sed and again use that script to translate English text to morse code. sed share | improve this question edited Apr 18 at 10:12 Kusalananda 102k 13 199 315 asked Apr 18 at 9:24 Somojel 21 2 Please give an example of the input, the expected output and why do you think that you need an intermediate file. You already know how to write an sed script to translate text to morse code directly, the same way you could translate back with a fixed script. Why do you think you would need a dynamical script? – Philippos Apr 18 at 10:29 add a comment  |  up vote 0 down vote favorite How can we use a file to make a script in sed and then using that script again to translate the text? Fo

Using ls and stat [closed]

Image
Clash Royale CLAN TAG #URR8PPP up vote 0 down vote favorite I have written this script, however the output is not correct. It returns stat cannot stat no such file or directory. The file format is Living Room-20180418-0955588134.jpg Any help will be appreciated. #!/bin/sh LASTFILE=$(cd /volume1/surveillance/@Snapshot && ls *.jpg | tail -1) # Input file # How many seconds before file is deemed "older" OLDTIME=3600 # Get current and file times CURTIME=$(date +%s) FILETIME=$(stat "$LASTFILE" -c %Y) TIMEDIFF=$(expr $CURTIME - $FILETIME) # Check if file older if [ $TIMEDIFF -gt $OLDTIME ]; then echo "No Movement Dectected in Last Hour" ; exit 1 fi ls stat share | improve this question edited Apr 18 at 9:53 asked Apr 18 at 9:40 Colin Davis 4 1 closed as off-topic by Kusalananda, Stephen Kitt, Jeff Schaller, Timothy Martin, Christopher Apr 18 at 18:54 This question appears to be off-topic. The user