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
18 views
syntax error: unexpected end of file
#!/bin/sh
if [ -e $1 ] ; then
mv $1 $1_$(date +%Y%m%d%H%M)
fi
exit 0
I requirement is to look for a file and if the file exits then rename the file and exit the prog, we need to rename only if the ...
0
votes
0answers
8 views
rsync in script on mac
I have a Script on my Mac Server to sync with another Mac Server.
#!/bin/bash
DestVolume="/Path/to/destshare"
SrcVolume="/Path/to/srcshare"
SSHKey="sshkey"
SrcUser="user"
SrcHost="remoteserver"
...
4
votes
4answers
106 views
Why is there an EOF in the middle of the arguments?
I wanted to write a little bash function such that I can tell bash, import os or from sys import stdout and it will spawn a new Python interpreter with the module imported.
The latter from function ...
2
votes
1answer
27 views
bash completion very incomplete on centos 7
I have installed bash completion using yum install --enablerepo=epel bash-completion. While it works for some basic commands (git & yum), I am missing a large part of the completers.
My ...
0
votes
0answers
9 views
On the relationship between shell initialization and desktop apps after a “graphic login”
I am very (zsh)/somewhat (bash) familiar with the shell's initialization sequence when the user logs in through a text interface.
But what about the case of a "graphic login", IOW, when the user logs ...
1
vote
1answer
19 views
Apply command between different directory names
I have directories A, B, C saved in path1
and directories A_1, A_2, A_3, B_1, B_2, B_3, C_1, C_2, C_3 are saved in path2
I have the same copy of "file.txt" saved in directories A, B, C in path1
I ...
2
votes
2answers
13 views
Execute code in a logout script if exiting from a particular directory?
I have accounts on a number of different machines for testing a couple libraries I contribute to. Some of the machines are owned by others (like the GCC compile farm), and I'd like to keep them tidy.
...
0
votes
0answers
8 views
Run applications through crosh/ shell bash [on hold]
How can I run applications through crosh/shell on Chrome OS?
-1
votes
0answers
26 views
BASH: Find command list only files in current directory matching a pattern specified [on hold]
I have a find command that list all files matching my pattern in the current directory
2.2.1$ find . -maxdepth 1 -name '[!abcfhxyz][!abcfhxyz]*' -print
./pie.c
./prog2.c
./tst3.ex
...
0
votes
3answers
37 views
bash script to read first argument as input and look for variable in another file line by line
I have a file "input.txt" has variables A1, A2, A3, θ, θ1 and θ2 - sample of input.txt is as follows:
$ cat input1.txt
A1=5.2 A2=4.9 A3=6.1 θ=space θ1=2.5 θ2=1.2
A1=3.1 A2=5.1 A3=3.7 ...
0
votes
1answer
21 views
Pipe encrypted archive to uploader
Assume, I do archive several files with this functions:
gen_password ()
{
gpg --gen-random 1 "$1" | perl -ne'
s/[\x00-\x20]/chr(ord($^N)+50)/ge;
...
2
votes
1answer
42 views
Redirecting looped grep commands to separate files
I'd like to use grep to recursively search through a directory, using patterns listed in a file, then store each result in its own file for reference later.
I'm a complete novice at bash scripting, ...
1
vote
2answers
29 views
Bash: pipe 'find' output into 'readarray'
I'm trying to search for files using find, and put those files into a Bash array so that I can do other operations on them (e.g. ls or grep them). But I can't figure out why readarray isn't reading ...
0
votes
1answer
51 views
Help creating a bash shell script based around the ls command [on hold]
I'm trying to create a bash shell script that will take an input directory and give me the name and size (with units) within. I'm a bit new to shell scripts, so I've been able to build the script to ...
4
votes
1answer
34 views
bash does not exit on abnormal exit of child process due to signal
I try really hard to understand what I am doing wrong and why?
I have a launch.sh script which launches process.sh.
launch.sh
#!/bin/bash
while true; do
./process.sh
done
process.sh
...