Tagged Questions
2
votes
1answer
48 views
bash script - supervisor program
I have to write a shell-script that have to do the following tasks:
-in every 5 seconds it saves:
-how many users are using joe and/or vi;
-if ...
2
votes
3answers
46 views
Very strange behavior with grep and IFS
I'm having trouble using grep, the returned results are "n-empty", I mean without the 'n' character...
This is the script sample :
OLDIFS=$IFS
IFS="\\n"
i=$(grep -ril $1 *)
echo $i
IFS=$OLDIFS
...
2
votes
3answers
57 views
How to convert all .wav files in subdirectories to .aac using neroAacEnc?
I have a collection of music in .wav format, and would like to convert it to .aac/.mp4 using neroAacEnc.
How do I do this?
I am using Arch Linux x86_64 and Xterm.
8
votes
2answers
146 views
how to get exit status from the command before the last
I have solaris machine ( solaris 10 )
please Look on the following simple commands (haconf -makerw | grep -iq "Cluster already writable")
# haconf -makerw
VCS WARNING V-16-1-10364 Cluster ...
5
votes
4answers
110 views
Show sum of file sizes in directory listing
The Windows dir directory listing command has a line at the end showing the total amount of space taken up by the files listed. For example, dir *.exe shows all the .exe files in the current ...
1
vote
0answers
45 views
Using sshpass, return code (exit status) differs for reasons unknown using valid commands
There are a few things going on here but I think ultimately, either CLish or SSH is returning an exit code that is messing up my work flow.
I'm attempting to connect to a remote machine (CLish shell) ...
3
votes
1answer
59 views
Prompt for confirmation for every command
I'm writing a pretty ad-hoc install script for some thing. No much control constructs, basically just a list of commands. I'd like the user to confirm each command before it gets executed. Is there a ...
1
vote
2answers
56 views
bash if statement behaviour question
I wrote this following piece of bash script.
if [ $(tmux has -t junk) ]
then
echo zero
else
echo one
fi
It always returns one, no matter if the session exists or not. I checked in the command line ...
2
votes
2answers
80 views
Bash string comparison inside if [closed]
Read that for comparing string inside if we need to use double square brackets. Some books says that comparison can be done by =. But it works withe == also.
#!/bin/bash
a="hello"
b="world"
if [[ $a ...
1
vote
1answer
100 views
How to create a password protected shell script [duplicate]
How can I create a password-protected shell script for read/write access. It should also be executable by all users without the password. I have sensitive information in the script.
0
votes
1answer
81 views
Run expect script from other shell
My target is to create the /var/tmp/add_user.bash script from /var/tmp/create_script_add_user.bash script
and run the expect script (add_user.bash) from create_script_add_user.bash script.
The ...
0
votes
2answers
52 views
How to make any file and put contents in that using script
I want to modify configure.sh to create a file /etc/pam.d/XXX with some predefined content.
How can I do this by putting the file's absolute path and content in configure.sh?
Please explain the ...
2
votes
1answer
35 views
Bash: pair up two series of files
I have a number of files with this pattern:
file1_foo.ext
file1_bar.ext
file2_foo.ext
file2_bar.ext
and so on.
I need to "pair them" and put them in a file like this
file1_foo.txt ...
3
votes
2answers
81 views
How to run "find -exec <script> {}\;
I have a script that changes the properties of the files for a folder.
Here is the example tree:
dir 1
--file 1
--file 2
--file 3
dir 2
--file 1
--file 2
dir 3
--file 1
...
0
votes
3answers
76 views
How to create an interactive bash script to collect arguments for a command in linux?
I'm trying to create an interactive bash script where I can collect user input variables to be used as arguments in another command. Can someone provide me an example of this?
Currently i want to do:
...