Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
-4 votes
2 answers
87 views

Linux kill command returns "No such process"

In the below shell script I have list of process IDs which need to be killed. When killing a process I am getting kill: 1234567: no such process error even after checking if the process id existence ...
Harry's user avatar
  • 207
-3 votes
3 answers
76 views

How to pass an array as an argument to a function

In the below shell script I am passing an integer and a string array to a print function which should print each parameter separately, but I'm not able to. I don't want make a reference of passed ...
Harry's user avatar
  • 207
-1 votes
3 answers
100 views

Generate hashes automatically and continuously with a script and stop by pressing a key?

I need a part for a script in bash where hashes are generated automaticaly and continuously and when I press a key the generation stops and the last hash at which I stopped is displayed. I've cobbled ...
Orhan's user avatar
  • 67
0 votes
1 answer
61 views

How to pass an argument by reference to a function in KornShell (PDKSH 5.2.14)

In Bash I can use local -n ref_name=$1 to pass an argument to a function by reference, but the same syntax in ksh throws an error saying typeset: -n: unknown option I tried nameref ref_name=$1 ...
Harry's user avatar
  • 207
1 vote
2 answers
179 views

Check if a given function name exists in a sourced shell script file

In Bash I can use $(type -t function_name) = "function" to check if the function by name function_name exists or not in a sourced file which is sourced using source file_name command. I'm ...
Harry's user avatar
  • 207
1 vote
1 answer
66 views

List all the directories residing in a directory path using KornShell

I have the below shell script which works fine in Bash to list all the directories residing inside a given directory path and add them to an array. But the same script code doesn't work in KornShell. ...
Harry's user avatar
  • 207
4 votes
4 answers
743 views

How to check if a path exists from a string with case insensitive?

Hello i try to check if a path exists with a if statetment in a bash script from a string. I try the follow but nothing seems to handle this. The path is /home/orhan/Blog/Mai1 path='/home/orhan/blog/...
Orhan's user avatar
  • 67
2 votes
2 answers
368 views

Can I execute multiple case blocks if the pattern matches?

I want to know if there is another alternative in Bash to execute multiple blocks when the pattern matches. I don’t want to use another command, if statements, or two or more separate case blocks or ...
ReflectYourCharacter's user avatar
3 votes
3 answers
466 views

How to wait for background commands that were executed within a subshell?

Given this code: #!/bin/bash set -euo pipefail function someFn() { local input_string="$1" echo "$input_string start" sleep 3 echo "$input_string end" } function ...
k0pernikus's user avatar
  • 16.6k
9 votes
7 answers
969 views

Check if multiple files exist on a remote server

I am writing a script that locates a special type of file on my system and i want to check if those files are also present on a remote machine. So to test a single file I use: ssh -T user@host [[ -f /...
Nunkuat's user avatar
  • 193
-2 votes
2 answers
69 views

HISTTIMEFORMAT not working as desired in RHEL 8 bash 4.4.20

so trying to capture history with date and readable timestamps AND the command should appear on same line. following is failing: Bash ver is: GNU bash, version 4.4.20(1)-release (x86_64-redhat-linux-...
Rajeev's user avatar
  • 256
1 vote
0 answers
51 views

How to send an email with an attachment, but so that the attachment is not saved on the mail server

I send emails from the terminal with mutt -s "This is Subject" -a a.txt -- [email protected] < test.txt. The a.txt attachments can be large, how can I avoid filling up the mail server? ...
Nikulok's user avatar
  • 33
2 votes
1 answer
108 views

Sending emails from the Linux terminal while preserving the fact of sending

I need to send a letter from Linux terminal to the recipient's mailing address. I want the fact of sending the letter, its title and its text to be saved in the sent section of my mailbox (the mailbox ...
Nikulok's user avatar
  • 33
5 votes
2 answers
829 views

What does VAR=() mean in a script?

In the file /usr/bin/gcore (which is a bash script on my system), there are the following lines: # When the -a option is present, this may hold additional commands # to ensure gdb dumps all mappings (...
The Quark's user avatar
  • 434
4 votes
0 answers
74 views

Recovering text of Unsaved document from process memory? (frozen Xed window - process still "running" but in Sleeping status)

The window of my text editor Xed froze with Unsaved documents just as I was doing 'File'->'Save as...' to save them... [How ironic.] Since the process still exists, I am trying to recover the text ...
The Quark's user avatar
  • 434

15 30 50 per page
1
2 3 4 5
462