I need to check if I Filesystem exists, and if it does exist there is 300 MB of space in it.
What I have so far:
if [ "$(df -m /opt/IBM | grep -vE '^Filesystem' | awk '{print ($3)}')" < "300" ]
then
echo "not enough space in the target filesystem"
exit 1
fi
This throws an error. I don't really know what I'm doing in shell.
My highes...
I have a bash script that I am modifying to accept key=value pairs from stdin. (It is spawned by xinetd.) How can I safely convert those key=value pairs into environment variables for subprocesses?
I plan to only allow keys that begin with a predefined prefix "CMK_", to avoid IFS or any other "dangerous" variable getting set. But the si...
I need to print the ASCII value of the given charecter in awk only.
the below gives 0 as output.
echo a | awk '{ printf("%d \n",$1); }'
Help please.
...
I think I've written maybe one shell script my entire life, and I'm not even sure if it's possible to do this, but I'm trying to write a script that will ftp the contents of a directory, one at a time. That is, it'll ftp one and then close the connection, then ftp the second, and close that etc. This is because there may be up to five ...
In my answer to this question, where the asker needed a fast way to get a directory listing of a folder on a network drive, I suggested using the DOS "dir" command. Unfortunately, it's a command, not a program, so you can't execute it with CreateProcess and so I had to put it in a batch file. I don't really like that solution. It feel...
What is the difference between the following two commands, when run on AIX?
/bin/sh 'ls -l -R'
/bin/sh -c 'ls -l -R'
...
Hi all:
We've got a multi-agent Java environment where different agent would most likely produce all sorts of exceptions thrown to stderr.
Here is a sample taken from the huge exception log
**java.security.AccessControlException: access denied (java.io.FilePermission ..\tournament\Driver\HotelRoomAnalyser.class read)**
at java.sec...
Is there any plug-in that provides an integrated shell (i.e. command prompt) in Eclipse?
The console only seems to be for interaction with a running program.
I've found a reference to the plug-in Open extern but that opens an external command window, and I'd rather have it integrated with Eclipse.
...
In bash how can I make a construction like this to work:
if (cp /folder/path /to/path) && (cp /anotherfolder/path /to/anotherpath)
then
echo "Succeeded"
else
echo "Failed"
fi
The if should test for the $? return code of each command and tie them with &&.
How can I make this in Bash ?
...
I have a string like sample.txt.pgp and I want to return sample.txt in a shell script (but, the string length will vary, so, basically all of the characters before the ".pgp"). Is there a substr function? Like, if I did substr('sample.txt.pgp', -4, 0), is it supposed to return sample.txt? Right now it isn't, so I'm wondering if I have...
How do you get the last day of the last month in csh?
Here is the code so far. The cal command below almost works if you execute it from the (FreeBSD sh) command line, but I'm having trouble escaping it properly to run within a script. By almost work, I mean it returns 31, when the last day of February 2010 is 28.
#!/bin/csh
set last...
So, I have a directory, and in it are several files. I'm trying to decrypt those files and then move them to another directory. I can't seem to figure out how to set the output filename and move it.
So, the directory structure looks like this:
/Applications/MAMP/bin/decryptandmove.sh
/Applications/MAMP/bin/passtext.txt
/Applications/...
#!/bin/bash
if test "$#" == "4"; then echo "$*"; else echo "args-error" >&2; fi;
This little code snippet troubles me a lot when I tried to run it on both Ubuntu and Cygwin.
Ubuntu runs bash version 4.0+ whereas Cygwin runs 3.2.49; But I reckon version collision shall not be the cause of this, this code runs well under fedora 10 which...
i have a renamed js file which i have to call in each of my php page. Now i want to replace that old name with the new one using shell.
what iam using is this :-
sed -i ’s/old/new/g’ *
but this is giving the following error :-
sed: -e expression #1, char 1: unknown command:
now how can i do this replacement??
...
The script below worked on my Mac OS X. I'm now using Ubuntu OS, and the script is no longer working. I'm wondering if there's something that I need to change here? I did change the first line from #!/bin/bash to #!/bin/sh, but it's still throwing up an error.... Essentially, I get an error when I try to run it:
Syntax error: end of ...
The script below used to work on Mac OS X, but, since moving it to Ubuntu, it doesn't seem to read from the password file at all. Even when I run it from the command line, no matter what I do, I get a popup prompt asking me for the password. As this will run via cron, I don't want this to happen... I want it to read the password from ...
Hi,
I want to be able to pass anything to a git command (maybe its a SHA, maybe it's just something like "origin/master" or "devel/epxerimental" etc.) and git tells me the ref path of the branch that the passed something lives in, e.g.
<git_command> 0dc27819b8e9 => output: refs/heads/master
<git_command> xyz/test => output: refs/remote...
Hi everyone,
I've playing around with linux and noticed that for some mysterious reason commands like '/bin/sh ' just will not work. Each time I'm trying to start a process it yields 'cannot execute binary file' error message.
m@sanctuary:~$ sh sed
/bin/sed: /bin/sed: cannot execute binary file
When I first launch sh and try to exec...
Hi,
I have been looking at the source code of the IronPython project and the Orchard CMS project. IronPython operates with a namespace called Microsoft.Scripting.Hosting.Shell (part of the DLR). The Orchard Project also operates with the concept of a 'shell' indirectly in various interfaces (IShellContainerFactory, IShellSettings).
No...
Im trying to make a script that will go into a directory and run my own application with each file matching a regular expression, specifically "Test[0-9]*.txt".
My input filenames look like this "TestXX.txt". Now, I could just use cut and chop off the Test and .txt, but how would I do this if XX wasn't predefined to be 2 numbers? What w...