I have this use case of an xml file with input like
Input:
<abc a="1">
<val>0.25</val>
</abc>
<abc a="2">
<val>0.25</val>
</abc>
<abc a="3">
<val>0.35</val>
</abc>
...
Output:
<abc a="1"><val>0.25</val></abc>
<abc a="2"><val>0.25</val></abc>
<abc a="3"><val>0.35</val></abc>
I have around 200K lines in a file in the In...
I have a script that looks like this
#!/bin/bash
function something() {
echo "hello world!!"
}
something | tee logfile
I have set the execute permission on this file and when I try running the file like this
$./script.sh
it runs perfectly fine, but when I run it on the command line like this
$sh script.sh
It throws up an ...
I have a directory of many files in Windows Vista. I'd like in a batch script to be able to pick the newest file and copy it to another location. Any ideas how I do that?
...
Linux bash script:
function Print()
{
echo $1
}
Print "OK"
This script runs successfully, when executed directly, and gives an error running with sudo:
alex@alex-linux:~/tmp$ ./sample-script
OK
alex@alex-linux:~/tmp$ sudo ./sample-script
[sudo] password for alex:
./sample-script: 1: Syntax error: "(" unexpected
Why?
...
Linux bash script:
#!/bin/bash
function Print()
{
echo $1
}
var="*"
Print $var
Execution results:
alex@alex-linux:~/tmp$ ./sample-script
sample-script
"*" is expanded to the list of files, which is actually script itself. How can I prevent this and see actual variable value? In general case, var can be more complicated tha...
I wrote a .sh file to compile and run a few programs for a homework assignment. I have a "for" loop in the script, but it won't work unless I use only integers:
#!/bin/bash
for (( i=10; i<=100000; i+=100))
do
./hw3_2_2 $i
done
The variable $i is an input for the program hw3_2_2, and I have non-integer values I'd like to use. How c...
Hi All,
Please help!!! ;)
I have a problem with this code in a batch file (Linux):
Mil=`date +"%Y%m%d%H%M%S"`
batch=`echo "${DatMusic}"`
TabimportEnteteMusic="importentetemusic.dat"
{
grep '^ENTETE' ${IMPORT}/${DatMusic} > ${IMPORT}/$TabimportEnteteMusic
mysql -u basemine --password="basemine" -D basemine -e "delete ...
I'm trying to write a Photoshop jsx script for extracting color values from a PSD template. The colors are defined as separate fill layers that I'd like to be able to loop through and create a hash of {layer_name: #hex_color} values. I'm not finding any documentation on reading the color value of the fill layer.
...
Hi, guys. This is a VBS script that opens google, fills a form, and clicks a search button.
set ie = CreateObject("InternetExplorer.Application")
ie.navigate("www.google.com")
ie.visible = true
while ie.readystate <> 4
wscript.sleep 100
WEnd
set fields = ie.document.getelementsbyname("q")
set buttons = ie.document.getelementsbyn...
Hi,
I have both Sybase and MSFT SQL Servers installed. There is a time when Sybase interferes with MS SQL because they have they have some overlapping commands.
So, I need two scripts:
A) When runs, script A backs up the current path, grabs all paths that contain sybase or SYBASE or SyBASE (you get the point) in them and move them all...
Why doesn't this work???
#!/bin/ksh
# array testfunc()
function testfunc {
typeset -A env
env=( one="motherload" )
print -r $env
return 0
}
testfunc # returns: ( one=motherload )
typeset -A testvar # segfaults on linux, memfaults on solaris
testvar=$(testfunc) # segfaults on linux, memfaults on solaris
print $...
I got this script for creating an HTML page from an image uploader, The only problem is that it overwrite's itself on every upload, I would like to change it so that I get sent an e-mail instead.
Ideas?
<?php
$destination_dir = "uploaded/";
$targetPath = dirname($_SERVER['SCRIPT_URI']) . "/";
$html_start = "
<!doctype html public...
I currently work in a position that i have to manage and access 1000s of pages for troubleshooting and new setup.... and im trying to figure out a way for firefox or chrome to setup ANYtime it sees for instance a a web based page for equipment like (CISCO, Linksys, Sonicwall, T1 controllers) from the manufacture in the Title bar or from...
I have the following simple script for backing up my website files and db. The script is run each day via a cron job.
#!/bin/sh
NOW=$(date +"%Y-%m-%d")
mysqldump --opt -h localhost -u username -p'password' dbname > /path/to/folder/backup/db-backup-$NOW.sql
gzip -f /path/to/folder/backup/db-backup-$NOW.sql
tar czf /path/to/folder/bac...
I am frustrated with string-to-number and number-to-string conversion in GIMP scripting. I am runnning GIMP 2.6.8 in Windows Vista.
I understand that GIMP's internal Scheme implementation changes over the versions and I can't seem to nail down the documentation. From what I can gather GIMP's Scheme is a subset of TinyScheme and/or s...
Hello,
I'm trying to put an animated PNG dynamically from external .js file. First I found a simple animated png solution, which draws an animation wherever you put the code within <script> tags, but now it looks like I don't know how to call the function properly from external file.
The script is from AnimatedPNG, and it looks some...
If your scripting language of choice doesn't have something like Perl's strict mode, how are you catching typos? Are you unit testing everything? Every constructor, every method? Is this the only way to go about it?
...
Is anyone aware of a Pascal interpreter/compiler which is embeddable in C++ (or anything else other than Pascal) applications? I am cloning (for lack of a better word) an application which uses an Object-Pascal compatible scripting language and needs to be script compatible. Am I going to end up writing an interpreter? (!)
...
I have a script in bash called Script.sh, and i need to know his own PID ( i need to get PID inside the Script.sh )
Any clues to realize this ?
Regards,
Debugger
...
I have to write a bash script that makes lot of things. I'd like to print messages as nice as init scripts do. For example:
Doing A... [OK]
Doing B... [ERROR]
....
Do you know any way to make this?
Thanks in advance
...