mirror of
				https://gitlab.com/ceda_ei/mark
				synced 2025-11-04 08:10:06 +01:00 
			
		
		
		
	Add initial files mark and markrc
Added default markrc and auto login on running it
This commit is contained in:
		
							
								
								
									
										17
									
								
								mark
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										17
									
								
								mark
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
#!/usr/bin/env bash
 | 
			
		||||
 | 
			
		||||
source ~/.markrc
 | 
			
		||||
today=$(date +%Y-%m-%d\ %H:%M:%S)
 | 
			
		||||
file_path=$base_path/$(date +%Y-%m).txt
 | 
			
		||||
login_message=$username $today $login_message
 | 
			
		||||
 | 
			
		||||
# Login if it is the first message of the day
 | 
			
		||||
if [[ -f $file_path ]]; then
 | 
			
		||||
  last_line=$(tail -n1 $file_path)
 | 
			
		||||
  last_day=$(echo $last_line | sed 's/[^ ] [^-]*-[^-]*-\([^ ]*i\).*/\1/')
 | 
			
		||||
  if [[ $last_day != $(date +%d) ]]; then
 | 
			
		||||
    echo $login_message >> $file_path
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
    echo $login_message >> $file_path
 | 
			
		||||
fi
 | 
			
		||||
		Reference in New Issue
	
	Block a user