Need a Single command to find the file and zip it and move to archieve folder
cd /sudheer/sudheerhome/logs
sudheer.1.log sudheer.2.log sudheer.3.log
cd /sudheer/sudheerhome/
archieve
Basically my requirement is find the "sudheer.1.log" zip them and move to archieve folder
Need in a single command
do you know?
how many words do you know
See also questions close to this topic
-
Linux on Lightsail instance is asking for a password and it's not working
I'm trying to restart
mariaDB
on Ubuntu but it's not letting me.I enter:
systemctl restart mariadb
and get:
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === Authentication is required to restart 'mariadb.service'. Authenticating as: Ubuntu (ubuntu) Password: polkit-agent-helper-1: pam_authenticate failed: Authentication failure ==== AUTHENTICATION FAILED ===
I have the same password for all functions so I do not understand why it is not working. What can I do?
-
How to tag and store files, by metadata, in Python?
I want to build a manual file tagging system like this. Given that a folder contains these files:
data/ budget.xls world_building_budget.txt a.txt b.exe hello_world.dat world_builder.spec
I want to write a tagging system where executing
py -3 tag_tool.py -filter=world -tag="World-Building Tool"
will output
These files were tagged with "World-Building Tool": data/world_building_budget.txt hello_world.dat world_builder.spec
Another example. If I execute:
py -3 tag_tool.py -filter="\.txt" -add_tag="Human Readable"
It will output
These files were tagged with "Human Readable": data/world_building_budget.txt a.txt
I am not asking "Do my homework for me". I want to know what approach I can take to build something this? What data structure should I use? How should I tag contents in a directory?
-
Installing pillow fails on Linux environment or Chrome OS. How do I fix this?
When I try to install pillow with pip3, it gives me the following error message.
failed building wheel for pillow
[omitted text]
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-092vzzoo/pillow/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-v4rw5g1c/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-install-092vzzoo/pillow/
-
Appending values to existing values of environment variables in go
How can I append another value to an existing value of a go environment variable?
If CGO_CXXFLAGS has the value "-I/blah/blah"
Since the following doesn't work
$ go env -w CGO_CXXFLAGS="$CGO_CXXFLAGS -I/foo/bar"
I want to find a proper way to CGO_CXXFLAGS have the value "-I/blah/blah -I/foo/bar"
by avoiding to simply re-set all the values plus the new one, such as in:
$ go env -w CGO_CXXFLAGS="-I/blah/blah -I/foo/bar"
-
Update global variable from while loop
Having trouble updating my global variable in this shell script. I have read that the variables inside the loops run on a sub shell. Can someone clarify how this works and what steps I should take.
USER_NonRecursiveSum=0.0 while [ $lineCount -le $(($USER_Num)) ] do thisTime="$STimeDuration.$NTimeDuration" USER_NonRecursiveSum=`echo "$USER_NonRecursiveSum + $thisTime" | bc` done
-
How do you use mktemp to create directory in Makefile?
edit:
Solved by awesome answer below. Expand the variables using := instead of =
mktemp: TEST:=$(shell mktemp -d) mktemp: echo $(TEST) touch $(TEST)/test.txt ls $(TEST) cat $(TEST)/test.txt rm -rf $(TEST)
original question:
This is a Makefile piece of code of how someone may use mktemp in a Makefile
TEST=$(shell mktemp -d) mktemp: echo $(TEST) touch $(TEST)/test.txt ls $(TEST) cat $(TEST)/test.txt rm -rf $(TEST)
This is an example output
❯ make mktemp echo /var/folders/62/wkysd_4n0w57ljl9ycfsd9cc0000gn/T/tmp.tQI5EeyW /var/folders/62/wkysd_4n0w57ljl9ycfsd9cc0000gn/T/tmp.tQI5EeyW touch /var/folders/62/wkysd_4n0w57ljl9ycfsd9cc0000gn/T/tmp.lVL3N8Rp/test.txt ls /var/folders/62/wkysd_4n0w57ljl9ycfsd9cc0000gn/T/tmp.sBW9FzgD cat /var/folders/62/wkysd_4n0w57ljl9ycfsd9cc0000gn/T/tmp.Ti53SWSw/test.txt cat: /var/folders/62/wkysd_4n0w57ljl9ycfsd9cc0000gn/T/tmp.Ti53SWSw/test.txt: No such file or directory make: *** [mktemp] Error 1
The expectation is that
cat /var/folders/62/wkysd_4n0w57ljl9ycfsd9cc0000gn/T/tmp.Ti53SWSw/test.txt
would not error.How can mktemp be used in this case?
-
How to embed file content into body of the email using mail command?
I have requirement,where i need to send file content as mail body.can we dot through unix scripting.
Thanks in Advance
-
I upgraded package with sudo, now I can only execute it with sudo
I executed
amplify add function
and this prompted me with a message that suggested me to upgrade amplify withamplify upgrade
. So I did that and I had a permissions problem, so smart me decided to executesudo amplify upgrade
, which upgraded successfully amplify.Now I can't use
amplify
anymore, unless it's preceded by sudo, so like this:sudo amplify
etc.If I use the
amplify
command with no sudo nothing happens, not even a command not found...just pure nothing. Please help me, it's driving me insane. -
How to source an env file and then execute Python script via cronjob?
I have several python apps. To run these apps, I must 1st execute the virtual environment by issuing the following command:
source venv/bin/activate
I need to run these files using a cronjob (on Unix).
How can I get the a BASH shell script to execute a python app and make it run in its virtual environment?
Thanks