I wrote this sh script here. What it suppose to be doing is it prompts the user to type in the old password, then checks the password with the password in the "PASSWORD.txt" file if not it would exit, else if it matches then it would ask the user to type in the new password twice. Then it checks if the two new passwords are the same if n...
Hi all.
I have a bunch of processes owned by apache that are running for days because they are stuck.
apache 11173 0.1 0.0 228248 27744 ? Ss Sep27 3:58 php /var/www/html/myproj/symfony cron:aggregation --env=prod
apache 12609 0.1 0.0 228244 27744 ? Ss Sep18 19:30 php /var/www/html/myproj/symfony cron:aggr...
Have been writing the shell script such as :
#! /bin/bash
`sqlplus -s <username>/<passwd>@dbname`
set echo on
set pagesize 0
set verify off
set lines 32000
set trimspool on
set feedback off
`SELECT tr.number, count(*) as total
FROM <dbname>.<tablename1> tr
LEFT JOIN <tablename2> t2 ON t2.i...
Is there a nice bash one liner to map strings inside a file to a unique number?
For instance,
a
a
b
b
c
c
should be converted into
1
1
2
2
3
3
I am currently implementing it in C++ but a bash one-liner would be great.
...
The "echo" below is failing and I am too retarded to figure out why. I am simply trying to echo all of the array members in my loop.
#!/bin/bash
foo=bar1,bar2
for i in ${foo//,/" "}
do
declare -a ${i}='(null null null null)'
echo ${i[*]}
done
Thanks for any help!
...
I want to represent multiple condition like this:
if [ ( $g -eq 1 -a "$c" = "123" ) -o ( $g -eq 2 -a "$c" = "456" ) ]
then
echo abc;
else
echo efg;
fi
but when I execute the script, it shows
syntax error at line 15: `[' unexpected,
where line 15 is the one showing if ....
What is wrong with this condition?...
The if [ {$i[0]} = "true" ] below is failing. I can't seem to figure out how to get the correct formatting for {$i[0]} in the if statement.
#!/bin/bash
foo=bar1,bar2
for i in ${foo//,/" "}
do
declare -a ${i}='(true null null null)'
done
for i in ${foo//,/" "}
do
if [ {$i[0]} = "true" ]
then echo "yes"
eval "echo \${$i[*]}"
else echo "...
I want to find a file with a certain name, but search in direcotories above the current one, instead of below.
I'd like something similar to: (except functional)
$ cd /some/long/path/to/my/dir/
$ find -maxdepth -1 -name 'foo'
/some/long/path/to/foo
/some/foo
Shell scripts or one-liners preferred.
In response to the several questi...
I have the following shell script. For some reason the java program's standard error and standard output is not printed to the file "log" but instead always appear in the console. Is there a type some where or am I missing something?
JAVACMD="java -XX:+HeapDumpOnOutOfMemoryError -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxre...
How to simulate key press event with ksh|bash script?
...
Hi,
I have the following problem:
I've a script that launch inside of itself a command with a parameter that is a secret.
For example:
#!/bin/bash
command secret
While running the command I can read through ps -ef | grep command which is the secret.
Is ther any way of hiding the secret in a way that through ps -ef the command line...
I am a Ruby programmer on Windows who trys to switch from Win cmd to Cygwin, but cannot achieve to execute batch files of Ruby gems.
I already stuffed any bin directory into the Windows PATH env. variable, including the Ruby bin where the executables are stored. Gems, however, are invoked by ruby.exe itself, which leads to the following...
#! /bin/bash
`sqlplus -s <username>/<passwd>@dbname` << EOF
set echo on
set pagesize 0
set verify off
set lines 32000
set trimspool on
set feedback off
`SELECT starts_with, SUM (total_records) total_records
FROM (SELECT ID,
(CASE WHEN ID LIKE '2%' THEN '2____'
WHEN ID LIKE '3%...
cat 1.html | grep "<title>" > title.txt
This wont work ..
please tell the best way to grab the title of a page using grep or sed ..
Thanks .
...
Is there a good tool out there to do this on a Linix machine using the bash shell? All I need is to issue different commands on a set of nodes in a cluster and when one of them is done with the job, I'd like to submit another one. Something very similar to what Hadoop can do. I would be interested in knowing the status of the job as well...
Hi,
Can anybody show me how to escape double quote inside a double string in bash?
For example in my shell script
#!/bin/bash
dbload="load data local infile \"'gfpoint.csv'\" into table $dbtable FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY \"'\n'\" IGNORE 1 LINES"
I can't get the ENCLOSED BY '\"' with double quote ...
for i in $LIST
do
CFG=`ssh $i "cat log.txt|awk '{print $2}'"`
for j in $CFG
do
echo $j
done
done
Say I want to print 2nd field in the log file on a couple remote host. In above script, print $2 doesn't work. How can I fix this? Thanks.
...
Given a .so file and function name, is there any simple way to find the function's signature through bash?
Return example:
@_ZN9CCSPlayer10SwitchTeamEi
Thank you.
...
I'm trying to find a bash script that will recursively look for files with a .bx extension, and remove this extension. The filenames are in no particular format (some are hidden files with "." prefix, some have spaces in the name, etc.), and not all files have this extension.
I'm not sure how to find each file with the .bx extension (i...
I tried to use the read/write file descriptor in bash so that I could delete the file that the file descriptor referred to afterward, as such:
F=$(mktemp)
exec 3<> "$F"
rm -f "$F"
echo "Hello world" >&3
cat <&3
but the cat command gives no output. I can achieve what I want if I use separate file descriptors for reading and writing:
...