Can PowerShell on Windows by itself or using simple shell script, list files and directory this way: (or using Mac OS X or Ubuntu's shell script)
audio
mp3
song1.mp3
some other song.mp3
audio books
7 habits.mp3
video
samples
up.mov
cars.mov
Unix's ls -R or ls -lR can't seem to list it in a tree structure unf...
For an assignment I need to determine the creation time of a random file. As far as I know, Unix does not store the creation time (in contrast to *-BSD). I think I've read somewhere that you should ask for the modification time instead but I don't know where and asking Google doesn't give me a non-ambigious answser either.
Any ideas?
...
Im trying to convert a size, lets say 244410368 bytes to xxxxxx mebibyte (MiB) but I have no idea how.
All this 1000 and 1024 bytes/bits are rather confusing.
...
Hey there everyone ... I have the following data, and I need to put it all into one line...
I have this:
22791
;
14336
;
22821
;
34653
;
21491
;
25522
;
33238
;
I need this:
22791;14336;22821;34653;21491;25522;33238;
If anyone could help me it would be a great !!
Thanks in advance!
--------- EDIT
No of these commands...
I have a Java application executed from a ([ba]sh) shell script and unfortunately sometimes the people responsible for deploying it and starting it fail to switch to the appropriate user before starting the application. In this situation I'd like the application to not run at the very least, and ideally issue a warning not to do that. ...
Hey there!!
Firstly, I'm really new on this and I'm having difficulties...
I have this data:
[05/Apr/2010:09:59:34 -0300] /~bcc/topo-zero.html 200 238
2
[05/Apr/2010:10:01:19 -0300] /~bsi/materiais/ed/u6.html 200 286960
3
[05/Apr/2010:10:04:56 -0300] /~firedo/AISG/AISGroupContributions.html 200 33193
2
...
Hi,
I want to run a shell script in php, but this shell script takes a long time to execute (it has sleep in it), I don't want the web server to block when executing this script.
I tried exec() and shell_exec() in php but the server stops until the shell script finishes!
I thought of doing fork in the shell script itself but I don't kn...
Example:
#!/bin/sh
a() {
R=f
ls -1 a*
[ "$?" == "1" ] && { R=t; }
echo $R
}
r=`a`
echo $r
$r contains "t" or "f" but also the output of the "ls" command.
I may write ls -1 a* >/dev/null 2>/dev/null, but if there is a more complex script that can be lead to errors.
Is there any way to return a single value from a() ?
...
Hi all,
I am operating in a Korn Shell, and attempting to run a simple chdb script I wrote. If run with no arguments, it prompts the user with a list of databases and waits for a selection. If called with a single numeric argument, it will automatically make the selection for the user.
Example:
> . chdb
Select the database sid from ...
Hi All,
I'm pretty new to Powershell. I have 2 different scripts I'm running that I would like to combine into one script.
Script 1 has 1 line
Stop-Process -ProcessName alcore.* -force
It's purpose is to end any process that begines with "alcore."
Script 2 has 1 line as well
Start-Service -displayname crk*
It starts any service ...
Hi,
I want to run a shell script which contains ssh command to run through a php web page. The shell script executes, but skips all the ssh commands. Is there a way to do this.
Thanks
...
Hi
I was wondering if anyone had any examples of how to use expect with -c.
Running:
my_machine~/opt/ams/data/ep/success$ expect -c "spawn /usr/bin/scp xmlEventLog_2010-03-22T14-28-36_PFS_1_2.xml [email protected]:/opt/ams/epf_3_4/xmlEventLog_2010-03-22T14-28-36_PFS_1277900174_2.xml; expect { '*password:*' { send 'ad'\r\n }}"
Doe...
I have a dataset contained in a directory that has about 30,000 sub-directories. Each of these directories contains a text file and another sub-directory. This sub-directory contains some number of text files (ranging from 0 text files, to hundreds). Many of my colleagues use this dataset, but as it is it takes at least 6 hours to tra...
How would I go about creating an AppleScript command that when I just run the script (or double click it in Finder?), it would run a set of terminal commands? The set of commands completely remove MySQL, and it has become a pain to constantly write them out. The commands are:
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo r...
Hi,
I want to pass many arguments to a shell script which I don't know how many arguments they are going to be and I want to handle them. I did the following code:
int=$1
src=$2
r=$3
string=$4
duration=$5
./start.sh $int $r $src "$string"
sleep $duration
shift; shift; shift; shift; shift
while [ $# -gt 2 ]
do
r=$1
string=$2
...
-not sure if this belongs here or on serverfault-
What I want to do it list all directories in a directory and delete all of them, except for the last 5. We have a deployment system in place that will incrementally do something link this:
/var/www/html/build1
/var/www/html/build2
/var/www/html/build3
/var/www/html/build4
/var/www/html/...
I have a folder with backups from a MySQL database that are created automatically. Their name consists of the date the backup was made, like so:
2010-06-12_19-45-05.mysql.gz
2010-06-14_19-45-05.mysql.gz
2010-06-18_19-45-05.mysql.gz
2010-07-01_19-45-05.mysql.gz
What is a way to get the filename of the last file in the list, i.e. ...
I am trying to run a shell from one of my controllers in a PHP codeigniter applications,
I am trying to run the file /x/sh/xpay4.sh however I just get 127 returned to the screen, I can even use basic commands like ls or pwd can any suggest why this would be, I thought it might be safe_mode when I ini_get('safe_mode') it returns 1
...
I am traping a signal SIGINT in one of my script I am writting for my project.
trap sigint_handler SIGINT
I am having signal handler
sigint_handler()
{
# echo caught signal, now quiting....
exit $?
}
So now when the script gets a CTRL+C signal it gets it and exits.
And on terminal it prints this message:
$^Killed by sig...
I have a shell script that constructs an awk program as a string then pass that string to awk. This is because I want to use values of shell variables in the awk program.
My code looks like this:
awk_prog="'{if (\$4~/$shell_var/) print \$1,\$2}'"
echo $awk_prog
awk $awk_prog $FILENAME
However, when I pass the string to awk, I always...