Restrict the use of someone running switches against the script [closed] - linux

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
pretty new to linux scripting but getting the hang of it.
My questions is:
I have created a basic script to encrypt files, I basically want to restrict people running script.sh --help and if they do run anything such as this provide an error.
at the minute if I run the above command it simply executes the script as normal.
Thanks for any help.

If I got right your question:
#!/bin/bash
ARGS="$1"
if [ "$ARGS" == "--help" ]; then
echo "I EXIT"
exit
fi
# DO YOUR STUFF

Related

Linux Internal Process for Cat and Grep [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm newbie to linux back round process, for example i have the below linux command, Maybe the question will duplicate here but i couldn't find answer so posting it.
cat test.txt | grep hello
how many back round process(s) will run? It would be great if insight on this.
There are two processes: cat and grep.
If you just launch the command line likt that, both processes are not background processes. (I guess you are asking background jobs?)
However, this example is not good, since you can just grep hello test.txt to save one process.
But if you just want to ask the number of processes, it's fine.

how to automate scp for multiple server? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have IPs of all machines are in one text file,how to do scp from one machine to all machines and automate task?
cat ips.txt | xargs -rtn1 sh -c 'scp /source-file "${1}:/target-file"' --
You probably need to adjust the command to your actual needs, which you didn't state.

Make screen shooter in bash [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have to make script similar to Screen Shooter. Unfortunately I am green in this topic. In connection with this I would like to ask if it is possible to write such a script? I know ScreenShots are possible, but can they be handled?
Regards
Example, screenshot script :
#!/bin/sh
import screen$RANDOM.jpg;
exit 0;
The script will display a cross-hair for selecting "screenshot size".
import is an imagemagick command : sudo apt install imagemagick
http://packages.ubuntu.com/xenial-updates/imagemagick

Cygwin - setting up $PATH [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I've found it's really difficult to setup path variable. I've tried a lot of combinations but nothing works at all. My over 1h work results are but as you see on screenshot (http://puu.sh/33n0X.png )
echo $PATH
give strange directory and
rm -rf k.txt
doesn't work at all. Does anyone has idea what is wrong there? I'm totally confused about it
If you want something a little more "normal", you can suppress the current PATH being appended, and just build your own.
In your ~/.bash_profile, put something to this effect
PATH=/bin
and if you want System32 you can add it as well
PATH=/bin:${TMP%U*}windows/system32
Example

How to know if a task in the crontab actually was executed [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a Script that is supposed to be execute by the crontab. How can I verify this at this moment if the task was programmed to be executed several hours ago?
You should modify your crontab file by adding a MAILTO=<your email here> before your cron so that you will be emailed the results of the execution. This won't solve your problem of knowing if the script executed in the past, but it may help you avoid this issue in the future. To make sure you get an email, just add an echo "Running script!" line to the top of your script.

Resources