I am trying to learn shell scripting and trying to create a user defined variable within the script, first:
howdy="Hello $USER !"
echo $howdy
However, when I execute the script (./first) I get this:
howdy=Hello aaron!: Command not found.
howdy: Undefined variable.
What am I doing wrong?
...
I'm trying to do a potentially long background process in response to an incoming AJAX request, but using nohup or setsid via shell_exec causes the server to fork bomb. We use suexec and FastCGI, and when it bombs it took the entire server to a crawl.
shell_exec("nohup /home/me/myscript.php");
The script doesn't do anything lengthy ri...
i would like to send a stream of bytes to a serial port using the command line. is this possible? my serial port is at /dev/cu.usbserial-A700dYoR on my Mac. for example, if i wanted to send the integer 50 or the string "data" to that serial port, how can i do that?
my knowledge of UNIX is very limited.
...
I'm working in Linux and am wondering how to have python tell whether it is being run directly from a terminal or via a GUI (like alt-F2) where output will need to be sent to a window rather than stdout which will appear in a terminal.
In bash, this done by:
if [ -t 0 ] ; then
echo "I'm in a terminal"
else
zenity --info --tit...
I have bash script that I use regularly in my job to automate a large job. I was making some changes today, but everything seemed fine. The script itself is about 1700 lines long. The first part of the script is all good and runs through all the user input and logic just fine. It then proceeds into the core of the script and stops wo...
I wrote a sh program which when you type in the argument which is a file name of an image the program would preview it and this can take multiple arguments (as show below)
#!/bin/sh
for i in $*; do if [ ! -f "$i" ]; then
echo "invalid file $i"
else
display -size 40x50 $i &
fi
done
How would i be able to limit the ...
hi, all, I have a python test script to test and launch several subprocesses and after some interval of time, terminate these subprocesses. e.g.
[username@machine workdir]python call_test.py
and inside one test case of this call_test.py, it is bit like this.
def test_launch_kill(self):
p1 = subprocess.Popen("./exec1")
thread...
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...
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...
Hi,
I have a shell script which I execute frequently in a day with different arguments and/or options each time. What I am looking for is a way to "browse through" different executions of this shell script before selecting a particular one through CtrlR facility. How do I do that?
Ofcourse I can type "history" command and browse throug...
I have some shell scripts on a Windows 2003 server. These scripts process some flat files and upload data to Oracle using sqlldr. Currently I'm using telnet to go into the box and run each of these scripts manually. Is there a way that these scripts can be run from a ASP.Net/Winforms application?
...
Hi,
I want to add a word to field 1 of a file separated by space,for example
My file,containing two fields:
apple:fruit:tree
orange:fruit:tree
mango:fruit:tree
brinjal:vegetable:plant
potato:vegetable:root
now I want to add word "family" separated by space to the field 1.
Therefore, the resultant file should look some thing like t...
The software Dropbox provides an shell extension which adds context menu items to all files in a specific folder. One of these generates a public link to view the selected file.
In a C# tool I want to call this entry without any user interaction. I want to achieve the same behavior as if the user clicked on the context menu item of a se...
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...
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 .
...
In Linux we can use the following command to change permission mode of the files and folders recursively.
find "/Users/Test/Desktop/PATH" -exec
* chmod 777 {} \;
how could i do the same for mac as i m getting the following error repeatatively.
find: TEST_FILE: No such file or
directory
...
What this is meant to do is, collects the arguments which are the names of the image files and checks them if they exist and are readable, then it converts the image to the preview file in the layout (imagename)_preview.jpg and underneath it it would have the size of the orignal file in 'bytes'.
Here is my script.
#!/bin/sh
clear
for i ...
I'm trying to use multiple parameters with the useradd command in linux, and I'm not really sure exactly what I should do??
I have tried the following:
useradd -b /home/ -g admin -m -p PASSWD -s USERNAME
Needless to say, it doesn't work. Can anyone tell me the correct syntax to get this working? Thanks, your help is always appreciated...
quick question, how do I write a shell script that prompts users to enter let say 5 lines and it will stores those lines into a .txt file for example,
Today is hot
Today is code
Today is chilly
Today is windy
Today is sunny
not like
Today is hot Today is code Today is chilly Today is windy today is sunny
Thanks for your help...
hello everyone I have 3 files:
engine script
#! /bin/tcsh -f
cat $1 |./hello
hello script
#! /bin/tcsh -f
set line1 = ($<)
while (${#line1} != 0)
set line2 = ($<)
set first1 = $line1[1]
set first2 = $line2[1]
if( $first1 == $first2) then
echo $first1 $line1[2] $line2[2]
set line1 = ($<)
els...