Hi
I often have to transfer 4000 small files to a remote server (around 20 MB of data), which I currently only have FTP access to.
This operation takes 30 minutes but if I were to send one file sized 20 MB it would take 2 seconds or so.
I am looking for an alternative which is faster, and which for example zips the 4000 files into one f...
I have a script that automates a process that needs access to a password protected system. The system is accessed via a command-line program that accepts the user password as an argument. I would like to prompt the user to type in his/her password, assign it to a shell variable, and then use that variable to construct the command line ...
Hi Folks,
I want to practice Unix (mostly Korn Shell Scription and VI Editor) on a windows Vista machine. Whats the best solution for this? I dont like Cygwin.. so anything other than Cygwin which gives the closest feel of Unix Environment without re-installing the OS.
Thanks.
...
Hi, I am trying to write a shell script that waits until the number of files in a specified directory ( say ~/fit/) has reached a predefined number. What I've got so far is:
limit = 10
while [ls ~/fit/ | wc -l -lt $limit]
do
sleep 1
done
This says -lt is an invalid option to wc. I also tried
[$limit -gt ls ~/fit/ | wc -l]
but i...
I need to increment minutes and seconds (in relation to time) in a variable.
First, I'm not sure whether declaring a 'time' variable is written as
time="00:00:00"
or
time=$(date +00:00:00)?
From there, I want to increment this variable by 10 minutes and seconds resulting in 01:00:00 increased to 01:10:10 to 01:20:20 etc (all t...
I'm using the bourne shell in UNIX, and am running into the following problem:
#!/bin/sh
while read line
do
echo $line
if [ $x = "true" ]
then
echo "something"
read choice
echo $choice
else
echo "something"
fi
done <file.txt
The problem I have here is that UNIX will not wait for user i...
Sorry if the title is confusing, but here's what I mean:
If I have a script that can accept several parameters, I'd use the getops command in order to more easily control script actions based on the parameters passed. However, lets say one of these parameters can be any number from 5 - 9, or whatever. Is there a way to tell getops that ...
Hello,
Shell Script
#! /bin/bash
sqlplus -s <username>/<passwd>@dbname << EOF
set echo on
set pagesize 0
set verify off
set lines 32000
set trimspool on
set feedback off
SELECT *
FROM <dbname>.<tablename1> tr
LEFT JOIN <tablename2> t2 ON t2.id2 = tr.id1
LEFT JOIN <tablename3> t3 ON t3.id2 = tr.id1
LEFT JOIN <tablename4> t4 O...
How do u redirect a small(<20k) file to be piped to another program, so that it is never written to disc.
You could use cfront and gcc as an example. Any example will do as long as you are redirecting something that normally outputs a file to something that usually accepts a file.
You could could use any script or shell, but I would pr...
Hello,
Just wanted to know if it is possible to switch to an aliased directory using shell script.
To switch to a directory there is cd command. But i have aliased the directory and wanted to know as how to switch to the aliased directory.
Could someone please help me?
...
Quick Background:
$ ls src
file1 file2 dir1 dir2 dir3
Script:
#!/bin/bash
for i in src/* ; do
if [ -d "$i" ]; then
echo "$i"
fi
done
Output:
src/dir1
src/dir2
src/dir3
However, I want it to read:
dir1
dir2
dir3
Now I realize I could sed/awk the output to remove "src/" however I am curious to know if there is a be...
I need to apply the eol-style property recursively on an existing repository.
The repository contains both text files and binaries. I want to apply this property only on the text files, and not on the binary files.
How can this be done from the command line or in a script?
...
I rename few files (1234.xml, 9876.xml, 2345.xml etc) with .xml extension with the following code :
for i in *.xml
do
mv $i $i.ab
done
it becomes 1234.xml.ab, 9876.xml.ab, 2345.xml.ab...etc
Now, I want to rename it to 1234.xml.SD, 9876.xml.SD, 2345.xml.SD...etc.
These are 100 files.
How can this be achieved with the hel...
hi,
I have to compare two files which are like
A B
--- ---
110-01 110-01
120-02 110-02
... 120-02
....
and have to print what are the extra elements present in the B file..
...
We have few executable which need some environment setting.
We manually running those scripts before running the executable
Like
$ . setenv.ksh
We have to encompass call these in one script to avoid the manual work.
We written a sh script like
#!/bin/sh
. setenv.ksh
./abc &
Still the environments are not setting in that session...
Basically I just want to tar all the files in a directory, but not get all the parent directories in the archive.
I've tried -C, but I guess I'm not using it right.
tar -cjf archive.tar.bz2 -C /var/some/log/path ./*
This results in tar trying to add all the files in the CWD. Using the full path as last argument doesn't prevent the di...
I`v wrote some script, and have unexpected end of file
echo off
if [$JAVA_HOME = ""]; then goto no_java_home fi
if [$SRV_HOME = ""]; then goto no_srv_home fi
echo Uses JAVA_HOME=$JAVA_HOME
echo Uses SRV_HOME=$SRV_HOME
export ACP=""
export ACP=$ACP;$JAVA_HOME/lib/tools.jar
export ACP=$ACP;$SRV_HOME/ant/lib/ant.jar
export ACP=$ACP;$SRV_...
Hi,
From shell script, I would like to create the empty 'Icon\r' file for a Mac OS X disk image (dmg), so as the .VolumeIcon.icns icon file is taken into account by the finder; the damn '\r' character is not accepted from the console:
touch Icon\r
ls Icon*
> Iconr
and other things happen when trying to type 'Icon\r', "Icon\r" etc., ...
Quick question: If I do the following, will it create the file, or do I have to do that separately?
echo "output" > file.txt
...
I would like to have a script wherein all commands are tee'd to a log file.
Right now I am running every command in the script thusly:
<command> | tee -a $LOGFILE
Is there a way to force every command in a shell script to pipe to tee?
I cannot force users to add appropriate teeing when running the script, and want to ensure it log...