The unix-shell tag has no wiki summary.
1
vote
3answers
117 views
Getting different values of particular variable from a file in UNIX
I have a file which I'd like to parse to extract certain values from it. I don't know what command and syntax I should use (maybe sed?).
Below are 2 sample lines which I might expect to find in the ...
1
vote
2answers
41 views
Solaris 8 - directories gone missing; is this housecleaning script the culprit?
Our outsourced IT service provider runs the following script via cron to clean up Oracle core and trace files. It clearly is not a well-written script, but my question for the Serverfault crowd is ...
0
votes
1answer
58 views
How to find a file that contains the specified string in FreeBSD?
I'm searching for the way to find a file that contains specified string text.
It should be fast as possible but its not that important.
I was reading the manual, and I've build something like that: ...
0
votes
0answers
68 views
secure way to store passwords in unix
OS: Unix (variety of flavors, redhat, hp, aix)
We need to store passwords on the operating system. We have jobs that need to log into other systems and databases. We are looking for a way to store ...
0
votes
2answers
126 views
How to secure svn+ssh checkout users?
All our SVN repositories are hosted on a dedicated machine on which all the developers have access. Every now and then we need to checkout a repository on a machine we don't own or operate ourselves. ...
0
votes
2answers
110 views
Is it possible to pass a shell variable from linux to windows via winexe?
I want to pass a shell variable called $test to windows from linux via winexe.
For example:
winexe -W WORKGROUP -U user%password //192.160.13.13 'cmd.exe /C move D:\restore_db\$test D:\Restore\'
Is ...
2
votes
3answers
219 views
grep - recognize carriage return as new line
I want to search a webserver running unix for php-files containing a specific string. Usually I use these commands to accomplish this:
find . -name "*.php" -print0 | xargs -0 grep -H -i "the string ...
1
vote
0answers
25 views
DreamHost: Run each site under a different user, with one Webmaster account that can access all the files
As a measure to combat the problem of hitting DreamHost's "soft" (undisclosed) RAM limit on shared hosting, I'd like to try running each domain/subdomain under a different UNIX user.
I would also ...
0
votes
3answers
45 views
portable unix way to join strings with separator
Is there a portable unix shellscripting way of joining a number of strings together with a given separator, like so:
$ strjoin --- foo bar baz quux
foo---bar---baz---quux
Sure I could use a ...
0
votes
4answers
45 views
Chars referenced by octal values in *NIX shell scripts — getting them to be parsed?
I have a script which absolutely 100% _has_ to be done in this ridiculous fashion:
echo $'\150\151\073\145\143\150\157' $'\171\141\171'
(unencoded: echo hi;echo yay)
The problem is that everything ...
0
votes
1answer
57 views
Check if drive has enough space before writing
I am looking to make a backup to a remote drive, but I want to do a check prior to doing so.
Is it possible to snatch only the "Available" space from the df output, rather than all of the details, to ...
2
votes
3answers
84 views
putty aborts process while shutting down
I'm newby so the question is simple. After I connected to server via putty I want to execute some command. Suppose that command will be performed for long time (e.g. extracting files from large ...
1
vote
1answer
57 views
Java command not going to background with &
I'm running a java command:
java weblogic.Admin -adminurl t3://URL:POST -username username -password password START $SERVER &
on an Aix machine.
The problem is that the shell still halts ...
0
votes
1answer
51 views
Shell command to find and file the last modified file in a certain directory
I want to create an alias that displays the latest log in a certain directory - something like:
ls -lat *log* | tail -1 | less
The above command does not work as the output of the ls -lat command ...
0
votes
4answers
181 views
Counting number of items in a single-row CSV file?
I have a file containing a long comma-delimited list of numbers, like this:
2,8,42,75,101
What's the simplest command (from a Unix shell) to get the count of numbers in this file? In the example ...
0
votes
1answer
77 views
Sending a message to a remote terminal
Is there a way to send a message to a remote terminal similar to using the wall command for other users on the local system? In this scenario I want to specify a username@hostname and have a message ...
0
votes
3answers
118 views
how to find the weblogic server start time in unix box
how to find the weblogic server start time in unix.
i have give ps -f | grep port number
but it is showing my current system time.
how to find this
0
votes
2answers
185 views
What are best practices writing parallel startup scripts in Unix shell (ksh,bash)?
I have a piece of software with different components running on the same Unix machine (web server, DBMS, middleware, different daemons). Startup of the few components depends on the success of the ...
0
votes
3answers
135 views
how to compare the files data in 2 different unix boxes
i have one file which exists in 2 different unix machines.
how i can compare the data with in the file
0
votes
3answers
97 views
install mysql on freebsd
How to install Mysql on freebsd , i have tried a lot but after i am getting lot many error so i have removed it , but now i want to reinstall it so , can anyone suggest me the link / commands to ...
0
votes
2answers
190 views
Vim how to change the cursor from char block to pre pipe/line
Not sure what the terminology is for it but on Vim the 'cursor' is always like an insert/replace cursor instead of the blinking line cursor I'm used to in other gui editors. Is there any way to change ...
0
votes
5answers
299 views
direct file transfer via ftp to ftp
Hi i want to transfer few file (which is very big in size ) from A server to B server via
ftp.
I have credentials of Server A's ftp and Server B's ftp - server B is my own server running
unix.
so ...
1
vote
5answers
317 views
Is there any browser utility I can use in SSH for Linux
Is there a text-based browser available for Linux (CentsOS) which I can use when I SSH to my server.
I use CentOS release 5.5. My server do not have graphic interface.
It would be nice if it ...
1
vote
3answers
158 views
'cd' switch back and forth to previous and current directory
I found cd - can switch back and forth between previous and current directory which is a very handy feature. Also found cd -- works too, but not sure what exactly that's for. Is there any reference ...
1
vote
4answers
234 views
Is there an easy way to insert data/time in front of a log file with just shell scripting?
Say I want to monitor memory usage on a java process overnight.
I can do something like
top | grep java > out.log
I will get a log file with a whole bunch of lines.
Is there an easy way to get a ...
1
vote
2answers
375 views
How to encode the rdesktop password parameter in a shell script?
I can connect with this script from linux to a windows RDP session:
#!/bin/bash
/usr/bin/rdesktop -N -x m -u Administrator -p secret123 -d DOMAIN1 127.0.0.1:33891
(The rdp port of the remote ...
0
votes
3answers
128 views
Bash as default shell for Netware user
I am connecting to the Novell Netware (OES) server via ssh. It shows me default novell console. I want it to start bash automatically when I connect. How can I do this?
0
votes
1answer
27 views
Turn off colors in Netware console?
I'm looking for a method of changing colors in default Novell Netware (OES) console
-1
votes
1answer
203 views
Wow, there is no way this is wrong. What is wrong? [closed]
I am going to put this out there first, this is my shell script homework. However, I am finished with my work. It is just not running properly for some reason. I already asked 2 game developer ...
0
votes
2answers
528 views
How to concatenate environment variable paths in a cleaner way in bash?
In order to modify my paths (like LD_LIBRARY_PATH or PYTHONPATH), I first check is the variable exists. If so, I'm concatenating my old value with the new one (separated with a semicolon), else I'm ...
1
vote
1answer
115 views
Picking a single line from a text file by its line number
In a Unix shell, how can I pick a single line from a text file by its line number?
Say I want whatever is at line 3 in animals.txt to be written to stdout (bat bat bat).
monkey monkey monkey
cat cat ...
2
votes
3answers
74 views
Will uploading modified version of a KSH script affect processes that are currently running the script?
Let say I have a KSH script my_script.ksh that performs complex operations including but not limited to invoking SQLPLUS to manipulate large number (millions) of records in an Oracle database. The ...
1
vote
4answers
211 views
Append an echo to file?
In linux, how do I do something like
echo 'hello world' > log.txt
but instead of overwriting the contents of log.txt, it appends to the end of of log.txt?
3
votes
2answers
147 views
How do I prevent bash $ substitution?
I'm trying to preserve $if below and
would like the following to output
$if
bash is getting in the way by doing
$ substitution
$ sed -e 's:\\$:\\$:g' <<ENDOFFILE
> $if
> ...
1
vote
1answer
230 views
Using a shell script to check if rsync made any changes
I've got a bash script that rsync's two directories. Sometimes there's a change, odds are there's nothing.
I want to run a command only if rsync actually made a change (add/update a file). ...
3
votes
2answers
246 views
Shell scripting and regex: Which one is better to match numbers, [[:digit:]] or [0-9]?
As the title suggests, which one is better to match numbers, [[:digit:]] or [0-9]?
I'm using the bash shell
Thanks :)
1
vote
2answers
132 views
Unix/Linux command to view available servers
Situation: I'm inspired to work from home this evening. So I download some source from work's svn repo. Unfortunately, I find some lib files are missing. Not a problem, I'll remote in to my desktop at ...
0
votes
2answers
127 views
How do I traverse the filesystem looking for a regex match?
I know this is teeball for veteran sysadmins, but I'm looking to search a directory tree for file contents that match a regex (here, the word "Keyword"). I've gotten that far, but now I'm having ...
-2
votes
2answers
383 views
Run bash script with command line arguments
I want to do
/usr/bin/bash myscript.sh -args
which, as it stands, runs the script but doesn't pass the args to it. I realize that the conventional syntax is simply
./myscript.sh -args
but I'm ...
0
votes
1answer
396 views
how to set the font with mailx?
Solaris Korn Shell
I am writing sql reports to an oracle database, spooling them to a file and emailing them with mailx. I use the syntax below. The reports do not format properly, unless I use the ...
1
vote
1answer
221 views
How to batch edit a list of files?
I have a list of files where I need to remove some lines that have been added yesterday by a spambot. The section I want to remove looks like this:
^M
<script>[...] bunch of malware code ...
1
vote
3answers
176 views
tcsh : path of sourced file
I am sourcing a file under tcsh. This file could be anywhere on the filesystem. How can I retrieve the path of my sourced file ?
$0 won't work : I don't execute the file, I source it.
Many thanks !
3
votes
3answers
226 views
Faking the date for a specific shell session
I'm certainly trying to achieve something weird here, but I want to fake the date locally for a shell session on GNU/Linux.
I need to black-box test how a program behaves at different dates, and ...
1
vote
5answers
341 views
selective backup script in bash
I've been using this simple command (that's all I can do :) to backup the whole tree from my user data in NAS server for a year.
cp -r /STORAGE /BACKUP-STORAGE/YYYY-MM-DD
Unfortunately, after a ...
3
votes
4answers
105 views
Is there a way to prevent output from backgrounded tasks from covering the command line in a shell?
I would like to be able to run task(s) in the background of a shell and not have their output to stdout or stderr cover the command line at the bottom. Frequently I need to run other commands to ...
0
votes
1answer
66 views
What file is in every unix login? [closed]
I was asked that question and to be honest not sure if I understood that. I would say shell but instead of shell we can run any other program so ...
any idea by unix gurus?
3
votes
3answers
938 views
how does cd command work? (unix)
could anybody explain to me how cd - command work? man cd tells me that An argument of - is equivalent to $OLDPWD. Then I found on the net that $OLDPWD is the previous working directory as set by the ...
1
vote
2answers
649 views
How to change VGA mode after boot and login with ubuntu?
Is there a way to change the screen resolution of the console after the system has been booted? I've seen plenty on setting the vga= line in the boot and in the grub config but I'd like to be able to ...
1
vote
1answer
119 views
force unix program output redirect
I'm new to shell-scripting and I guess this should be something quite easy. Anyway I don't know how to force redirect a program's output to the input of another program. I know about the pipe, where ...
2
votes
6answers
310 views
Last command issued on a GNU/Linux box
Someone asked at the mailing list of my local LUG if there is any way of learning the last command issued on a GNU/Linux system.
We're talking last command in a system-wide fashion I guess. After ...