Tagged Questions
2
votes
1answer
46 views
Shell script filtering through jpg files attributes
I'm trying to find a way to filter through thousands of jpg files, and keep only the files with a certain attribute (such as the camera brand with which the picture was captured). How can I do so?
3
votes
2answers
43 views
issues with GNU tail -f and combination of commands
$ tail -f /logs/filename.log | awk '!(/list)'
I am able to run this command in GNU Linux flavour
But when I written in a script it is not working.
test.ksh:
variable="/logs/filename.log | awk ...
4
votes
3answers
208 views
What does the following Bash script mean/do?
What does the following script mean?
exec 4<&0 0</etc/XX/cfg
read line1
exec 0<&4
UPDATE
Thanks for the answer, just one part I'm not sure:
It redirects fd0 to fd4, and ...
2
votes
2answers
86 views
List of script( location)s that get run automatically, and when?
Does anybody know (of a resource listing) what scripts are run automatically, and when, from the moment I startup the computer until it's shutdown again.
I know several places where I can add scripts ...
4
votes
6answers
249 views
Linux script or program to shorten filenames
I haven't had much success in finding a Linux version of namemangler, which I need to rename 1000 of files so they are readable on Windows.
Does anyone know of a Linux program that can do this?
If ...
0
votes
3answers
149 views
Pass command line arguments to bash script
I am new to bash script programming.
I want to implement a bash script 'deploymLog', which accepts as input one string argument(name).
[root@localhost Desktop]# ./deploymLog.sh name
here I want to ...
-1
votes
2answers
61 views
Shell programming temp=$1 vs temp=1
What's the difference between temp=$1 and temp=1? Why do I need the dollar sign?
For example:
#!/bin/bash
temp=$1
cell=$((($temp-32)*5/9))
echo $cell
1
vote
2answers
93 views
Issue with mv command in a script
This must be a very simple issue to solve, but I am stuck (not a UNIX pro). I need to move a gz to a target directory, but I get a No such file or directory.
NOW=$(date +"%Y-%m-%d-%T")
...
1
vote
2answers
96 views
$2 (field reference) in awk BEGIN is not working
In the following snippet, $2 in awk is returning empty. What am I doing wrong? I am trying to find the difference between MAX and MIN.
#!/bin/ksh
if [ $# -ne 1 ]; then
echo "Usage: sh ...
3
votes
1answer
103 views
Efficient way of comparing in awk
#!/bin/awk
BEGIN {
while(getline var < compareTo > 0)
{
orderIds[var]=var;
}
}
{
if(orderIds[$0] == "")
{
print $0;
...
2
votes
3answers
227 views
How do I run a script n times at same time and how do I simulate a semaphore?
I have a text file, inside of this file is a number, and I have a script.sh in ksh.
The script reads the file and gets the number, then increases the number by 1 and overwrites the new number in the ...
4
votes
3answers
104 views
List elements with spaces in zsh
I've been studying zsh scripting for all of 2 hours at this point and I've hit a wall. I want to go through a list of files that may have spaces in them. I'm open to completely different approaches ...
1
vote
1answer
68 views
How to access user's fpath as opposed to system's fpath with a script?
test.zsh:
#!/usr/bin/env zsh
for f in ${fpath}; do
echo ${f}
done
outputs:
...
4
votes
2answers
134 views
Convert a typescript file to a list of commands (history)
I wanted to record a linux session so I could use it as documentation for a "how to install" guide. I found something on the internet that suggested that the script command would be good for this, and ...
9
votes
2answers
409 views
Confusing use of && and || operators
I was skimming through an /etc/rc.d/init.d/sendmail file (I know this is hardly ever used, but I'm studying for an exam), and I've become a bit confused about the && and the || operators. ...