shell-scripting

[iPhone] Build,Install,Execute an application without using XCode

Hi, I would like to build, install and execute an xcode project on device but without using XCode GUI. Is it possible? Thanks in advance. Niko [EDIT] And what about an IPA? is it possible to install, execute an IPA application without using iTunes, only with shell commands? [EDIT 2] or maybe using Automator? ...

What is this line of shell script doing

Hi All This question may be pretty simple, but i dont find exact answers .. in shell script i have a line like this, export CFLAGS=" -w -Iinc/ -Isrc/" I dont know what is that -w and -I options doing here?? All i know is this line includes the directories inc and src Any help would be great ...

Shell Script (bash/ksh): 20 seconds to read a variable

Hi guys, I need to wait for an input for 20 seconds, after that myscript should continue the execution. I've tried using read -t20 var however this works only on bash. I'm using ksh on Solaris 10. Can someone help me please? EDIT: 20 seconds is only an example. Let's pretend it needs to wait for 1 hour. But the guy could or could not ...

bash evironment variables starting from a digit

I want to set an environment variable in bash, which starts from a digit. The environment of the process can contain such variables (it just doesn't care). But in the shell you have to create the variables, and then export them so they go to the environment. Is there a way to put some value into shell's environment without touching varia...

How do I get just real time value from 'time' command?

I would like to make a script that outputs only the real time value from the time command so I can plot the results. For example time command outputs real 1m0.001s user 1m0.000s sys 0m0.001s I want to write a script that outputs 60.001 How do I get just real time value from 'time' command in seconds? ...

Why use make over a shell script?

Make seems to me simply a shell script with slightly easier handling of command line arguments. Why is it standard to run make instead of ./make.sh ...

Removing Special Characters and bulk renaming

Hello, I am trying to make a shell script to remove special characters, like {}()!,' etc. So far I have referenced a past question I asked here, however I get a strange error message: -bash-3.2$ ./test2.sh ./test2.sh: line 7: unexpected EOF while looking for matching `"' ./test2.sh: line 10: syntax error: unexpected end of file test2....

bash: getting percentage from a frequency table

i had made a small bash script in order to get the frequency of items in a certain column of a file. The output would be sth like this A 30 B 25 C 20 D 15 E 10 the command i used inside the script is like this cut -f $1 $2| sort | uniq -c | sort -r -k1,1 -n | awk '{printf "%-20s %-15d\n", $2,$1}' how can i mod...

Run `head` on a text file inside a zipped archive without unpacking the archive

Greetings, I've taken over from a prior team and writing ETL jobs which process csv files. I use a combination of shell scripts and perl on ubuntu. The csv files are huge; they arrive as zipped archives. Unzipped, many are more than 30Gb - yes, that's a G Legacy process is a batch job running on cron that unzips each file entirely, rea...

Most efficient way to communicate from Shell Script -> Running Java APP

On one box there is a running java server I create. Another app allows me to call shell scripts to perform authentication function. I'm looking for an efficient way to talk between the shell script and the java server app. Obvious is launching another java app and using RMI, but this is not scalable to large numbers of calls. Is ther...

creating symbolic link from select file type in a folder

i have a folder with many different types of files...but i want to create a symbolic link of only files that are of a certain file type (the data files with extension *.txt.mrg) in this case...i want to have the same file names for the symbolic links as the original files...how do i do this? i want to be able to create all the symbolic l...

Declaring User Defined Variable in Shell Scripting (csh shell)

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? ...

Set default user variable in csh scripting

I am writing a csh shell script, run where the user is expected to pass a path into it as the $1 variable. How can I determine if $1 is missing and define a default value instead for it? ...

How to change shells in script

The default shell on the the system is csh but I want to write a script in bash. How do I write a script that will run bash and then convert back to csh at the end. I tried this but it doesn't work: bash var=Hello echo $var csh ...

Set default user variable in bash scripting

I am writing a bash shell script, run where the user is expected to pass a path into it as the $1 variable. How can I determine if $1 is missing and define a default value instead for it? ...

Remove file from different directory

How do I remove certain files from a different directory than $PWD using the bash shell script. Looking at the documentation for rm, it appears that rm only works in $PWD. Am I forced to use this method: oDir=$PWD cd directorytoremovefiles rm files cd oDir ...

How to convert DATE to UNIX TIMESTAMP in shell script on MacOS

On Linux you can convert a date like "2010-10-02" to a unix timestamp in shell script by date -d "2010-10-02" "+%S" Since Mac OS does not have the equivalent -d for date. How do you go about converting a date to a unix timestamp in a shell script. ...

Trying to limit the preview image

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 ...

How to do "tail this file until that process stops" in Bash?

I have a couple of scripts to control some applications (start/stop/list/etc). Currently my "stop" script just sends an interrupt signal to an application, but I'd like to have more feedback about what application does when it is shutting down. Ideally, I'd like to start tailing its log, then send an interrupt signal and then keep tailin...

Regex match in shell script

I'm writing a shell script that makes sure my DNS server is looking. Here's the output it tests: Server: 127.0.0.1 Address: 127.0.0.1#53 Name: galapagos.office Address: 192.168.140.25 Everything but the "galapagos.office" needs to match exactly. The "galapagos.office" part itself doesn't actually matter at all. I fi...