Linked Questions

0
votes
1answer
166 views

Conditionally command line export variable

If I run export COMMAND=nonexistentcommand && which $COMMAND >/dev/null || \ (echo "download filewithcommand.sh" && export COMMAND=./filewithcommand.sh) echo "command: $COMMAND" ...
2
votes
2answers
78 views

How do I replace words with increasing numbers?

For example, the only thing in file.txt looks like this: xxxxxxxxxHAHAxxxxxxHOHOxxxxxxx I hope to replace HAHA with seq 1 3 and replace HOHO with seq 5 7, so the output should be: ...
2
votes
1answer
72 views

Why “ >/dev/console” for remote beep (echo-command)

I've learned that this command: echo -e "\a" triggers a beep on the local system, whereas this command: echo -e "\a" >/dev/console triggers a beep on a remote system. Why is this? What is the &...
0
votes
2answers
138 views

How to run sequentially two tasks on linux [closed]

I'm using a keycloak server, when I run this command: standalone.sh This command launchs the server and I'm not able to stop it until I execute Ctrl-C command. I though about runing an instruction ...
-1
votes
1answer
130 views

just wanted to know what am i doing wrong in the end of this script that doesnt put my checkdate in to cal command

#Purpose: Validate a date #Usage: chkdate year month day # if [ $# -eq 0 ]; then echo Usage: chkdate year month day exit 0 fi year=$1; month=$2; day=$3; extra=$4 if [[ "$extra" != "" ]]...
1
vote
3answers
54 views

How to add a path before the first character of each line in a file.txt and save the same file with those edits? [duplicate]

I have a file that has some lines like: account_1 account_2 account_3 I have to add a path like /home/info/ before each line and save the same file with those updates like this: /home/info/...
-2
votes
1answer
68 views

What is the meaning of “<-” operator in bash? [closed]

In the installation instructions for KnockPY it says: nano knockpy/config.json <- set your virustotal API_KEY I need to understand what exact is '<-' doing in this command.
0
votes
1answer
145 views

Spawn multiple aws sync instances from a bash script [closed]

Im trying to have my bash script simply run a bunch of aws s3 sync commands at the same time and not do them one by one. It appears that it is only doing one of them at a time instead of doing them ...
2
votes
2answers
34 views

exclude target redirection file from being processed in for loop

This will cause LIST to grow very large (even a couple of GB in a short time etc): $ for i in *; do echo $i; cut -d ' ' -f1 $i ; done > LIST For example, after 10 seconds: $ wc -l LIST ...
0
votes
1answer
94 views

Writing file to specific USB device

I am looking to write the output of cat /var/log/dpkg.log to a file rather than viewing on the screen. I have tried cat /var/log/dpkg.log | file.txt without any success. Ultimately I want ...
0
votes
2answers
68 views

Command working in interactive shell, but not inside script

I have a text file named crn.txt containing text below: 9 1 * * 3,6 /opt/testtingtools/kos/bin/cos.sh 55 23 * * * /opt/testtingtools/tqdaily.sh 2>>/opt/toolcheck/extract.err 50 11 * * 6 /opt/...
2
votes
3answers
98 views

How to copy just certain words from a file into a new file

I have a homework assignment where I have a file that is a large list of words. I have to copy into a new file all the words starting with c and name it cwords. I can see a list of the words by ...
0
votes
1answer
53 views

How to maintain only four lines in my file in shell scripting?

Input file: 01.05.2016 87893938 02.05.2016 35435345 03.05.2016 35435345 04.05.2016 12345678 I want to keep only four lines in my file. that means if date 05.05.2016 6905698 is inserted then ...
0
votes
0answers
66 views

Why output redirection is not working? [duplicate]

Let's say I have a file named 'newfile' . Now I do some text substitution using sed command sed 's/text1/text2/' newfile > newfile In the above command I am subsituting text1 with text2 and then ...
0
votes
1answer
51 views

How can I use a file in a command and redirect output to the same file without truncating it? [duplicate]

cat package.yaml > package.yaml The above will truncate package.yaml, and hence the file will be empty - cat will have empty output. How can I avoid truncating the file? Is there an alternative ...

15 30 50 per page