I'm begginer with Make and i'm stuck with the most simple makefile, I think.
I wrote the following makefile :
hello:
echo "hello world"
And when I do in Windows Powershell :
PS C:\Users\Thibault\Documents\repo\myfolder> echo "hello world"
hello world
PS C:\Users\Thibault\Documents\repo\myfolder> make
make: *** No rule to make target 'echo', needed by 'hello'. Stop.
Thanks for any help
Related
I have a very simple startup task commandline
"cmd /c echo Hello world from the Batch Hello world sample!"
it keeps on running into error , what am i doing wrong ?
I am using MicrosoftWindowsServer WindowsServer 2016-Datacenter-smalldisk (latest) image for my windows
It appears that you have quoted the entire CommandLine. Instead, you should quote the command portion only:
cmd.exe /c "echo Hello world from the Batch Hello world sample!"
#!/bin/sh
# Define your function here
Hello () {
echo "Hello World"
}
Hello
above script is running fine in ubuntu but showing following error
on redhat machine
"syntax error near unexpected token ' { "
Ubuntu's Shell is bash but its not shells error becuase i am using ubuntu and your program give me o/p like this
sh hello.sh
Hello World
today I was trying to replace a bash script with a groovy script. Everything runs smooth and I managed to use the execute() command to invoke other command.
Then I was trying to send an email with a subject:
mail -s "this is a test" my.mail#example.com < mail.tmp
turned into
'mail -s "this is a test" my.mail#example.com < mail.tmp'.execute()
does not work since groovy will split up the one argument "this is a test" into four arguments "this is a test".
So far so good. Google helped me to turn this into
['mail', '-s', "this is a test", 'my.mail#example.com', '<', 'mail.tmp'].execute()
Now the subject is recognized as one parameter, but the < is also recognized as parameter and not as the file redirection.
Any idea how I could solve this?
PS: no, I would not like to use java code for sending mail since I guess the code will be more complex. But if you have a java one-liner, you are welcome...
You'll have to handle writing the output from the process to a file ...
new File('mail.tmp').withWriter { it << """mail -s "this is a test" my.mail#example.com""".execute().getText() }
I only tested above with "ls -al" as the command and it worked as expected, I'm not sure if a longer running process would require you to tweak the way you go about it-- if so you might need to use waitForProcessOutput:
new File('mail.tmp').withWriter { """mail -s "this is a test" my.mail#example.com""".execute().waitForProcessOutput(it, it) }
Found another solution which looks easier to me, but I guess isn't as clean as the one provided by #chrixian:
['sh','-c','mail -s "this is a test" my.mail#example.com < mail.tmp'].execute()
this command creates another shell in order to execute the mail command. This way, the 'mail -s "this is a test" my.mail#example.com < mail.tmp' is interpreted by a shell and it knows how to correctly handle the parameters and < symbol.
Drawback: it works on *nix systems. For windows systems, the shell is executed in a different way.
I am having trouble launching an executable that I have created from a shell script. I would like to automate testing by running the program many times with different command line options to verify it is working.
When I type echo $SHELL, /bin/sh is displayed.
The following is my shell script:
#!/bin/sh
clear
echo "Running first test."
./myProgram
exit 0
When I run the script (sh myScript.sh), with myProgram in the same directory, I see the following output:
Running first test.
: not foundsh: line 4:
When executing the program ./myProgram, it runs as expected with no command line options.
I have also tried:
myProgram
./myProgram &
myProgram &
based on answers to somewhat similar questions, but they all result in the above error message.
Your newlines are goofed. Use dos2unix to fix.
why don't you try using the full path?
e.g., if myProgram is in /home/user1/bin, you can try /home/user1/bin/myProgram instead of ./myProgram. This should work.
You can also add the path to path variable, $PATH and directly call myProgram from anywhere.
Run "export PATH=$PATH:/home/user1/bin" on your terminal without the quotes. Note that this affects only your current termial session. If you want to permanently add the path, update your .bashrc file in your home directory with the following line:
On MacOS 10.7.5, the following Applescript
tell application "Terminal" to do script "echo foo"
opens a new Terminal window but foo is not printed. Using the command echo is nothing special, I can't get any command executed at all (I found the bug as I tried to have the command cd executed). I found a workaround:
tell application "Terminal"
do script
do script "echo foo" in window 1
end tell
Am I missing something? Or is it the expected behaviour?
I would just use:
do shell script "echo foo"
But, if you want the response of the shell script, you can use:
set shellresponse to do shell script "echo foo"