Questions about bash only, as opposed to other Bourne/POSIX shells. For all Bourne/POSIX-style shells, use the /shell tag instead.
0
votes
0answers
12 views
Tmux has different environment variables?
I'm on a RHEL 6 system and I recently noticed I was running into proxy issues when running commands in tmux.
When I echo $HTTP_PROXY in tmux, I get nothing. But, if I open a terminal on it's own ...
3
votes
0answers
18 views
How to get the GPU execution time of a script in the shell?
I would like to display the completion time of a script, in terms of GPU time (not CPU).
For the CPU, I can simply use time:
francky@gimmek80s:~$ time ls -l
total 8
drwxrwxr-x 3 francky francky 4096 ...
0
votes
2answers
23 views
Appending Echo [Password Generator]
I am creating a password generator however I am not get the passwords to append properly.
Here is my script
i="0"
while [ $i -lt 5 ]
do
echo -n '#' >> passwords.txt && openssl rand ...
0
votes
0answers
39 views
Bash script to create and chown log files
I'm creating a bash script to provision a server. It basically installs the required packages, sets up any configuration etc.
I need to create various log files in /var/log/ and chown them. The ...
5
votes
2answers
430 views
problems with unusual file name
I have file called '-l' in my directory
now I tried to do
for i in *; do stat -c "%s %n" "$i"; done
it lists all files with sizes but in the middle of the output there is something like
395 koko.pub
...
0
votes
0answers
24 views
Decode Text in Bash Submitted From a Web Form
I have a small obstacle on a project I've been working on so basically I have a web form which can accept and interrupt any bash commands without any problems as long as they doesn't contain the ...
-3
votes
0answers
21 views
switch user to sudo su root and connect the fttp get the file in local machine and unzip
Hi i'm writing script change the user but i'm not able to give the password,i'm trying change the user and connect to fttp server and get the .gz file from fttp to local machine gunzip that file and ...
1
vote
1answer
30 views
wait for predefined time before exit the script
I have an app server running in my unix box with process name as abc_test. I have a shell script in which I have to stop my server using /opt/abc/bin/stop. Now sometimes my server doesn't get stopped ...
0
votes
3answers
20 views
Matching lines in two files [duplicate]
Let's say I have two files, file1 and file2.
file1:
passd:xxx
hopla:alli
gnar:gungg
araf:utap
file2:
alli
utap
How can i check what lines/words from file2 match file? Indeed I could probably do ...
-1
votes
1answer
45 views
Grep/sed between two strings
I have this code at the moment
cat -n rfile | sed -n '/"semantic_url":"/,/","/p'
where rfile is a file with a lot of text. I am trying to extract everything between every
"semantic_url":"
...
6
votes
3answers
448 views
Meaning of [ “${1:0:1}” = '-' ]
I have the following script to launch a MySQL process:
if [ "${1:0:1}" = '-' ]; then
set -- mysqld_safe "$@"
fi
if [ "$1" = 'mysqld_safe' ]; then
DATADIR="/var/lib/mysql"
...
What does ...
4
votes
3answers
66 views
Auto increment filename
I have a need to collect some duplicate files and want to avoid name collisions. The problem is that this collection of files might be added to by another execution of my script before the files are ...
6
votes
2answers
188 views
sudo (cd /some/dir; ./runscript.sh) fails
So, in bash, this works fine:
(cd /some/dir; ./runscript.sh)
assuming /some/dir/runscript.sh exists.
but
sudo (cd /some/dir; ./runscript.sh)
fails with the error:
-bash: syntax error near ...
1
vote
1answer
19 views
handle large number of same log using cron or logrotate
We have an app deployed in a server, which, under some scenarios, generates some logs in the below format.
process_name.hostname.common_text.log.{error/info/warning}.date.time
Now, due to this ...
4
votes
1answer
31 views
Turn off color in bash for logs
I am running Ansible on multiple machines and redirecting the output
to a file, say log-$(date), which is mailed to me every day. The
output file has multiple text colors, how to turn them off? ...