Tag Info

Hot answers tagged

3

First install the package inotify-tools: sudo apt-get install inotify-tools A bash script would help #! /bin/bash folder=~/Desktop/abc cdate=$(date +"%Y-%m-%d-%H:%M") inotifywait -m -q -e create -r --format '%:e %w%f' $folder | while read file do mv ~/Desktop/abc/output.txt ~/Desktop/Old_abc/${cdate}-output.txt done What does this script ...


2

a= cut -f 1 abc.txt This doesn't work, this will assign the word 'command' cut to the variable a. The correct syntax is a=`cut -f 1 abc.txt` Now you can run the command echo $a and check the result. Works The second command cut -f 1 abc.txt >a This will redirect the output of the command cut -f 1 abc.txt into a newly created file named a ...


2

The script below will move and rename any file that might appear in a defined directory (dr1). It renames the files like: output_1.txt, output_2.txt` etc. The script looks "actively" if the targeted name already exists in directory 2 (not from a "blindly" chosen range), so you can start and stop the script at any time without the risk of overwriting existing ...


2

You need to store the count somewhere it will persist across multiple runs of the script, since variables are just in memory for that single run. The easiest place is probably in a file. The particular way you store it in a file depends on a few factors including how many times you're counting, and whether you expect concurrent runs. A simple robust way ...


1

Microsoft's Visual Studio Code is an Integrated Development Environment (IDE) with support for Mac, Linux and Windows.


1

Install the package inoticoming sudo apt-get install inoticoming Create wrapper script watch_output: #!/bin/bash backup_folder="$HOME/backups" filename="$1" mkdir -p "$backup_folder" if [ "$filename" == "output.txt" ] then echo "New or changed file \"output.txt\" in $2" mv "$2/$filename" "$backup_folder/${filename%.*}.$(date ...



Only top voted, non community-wiki answers of a minimum length are eligible