A script is a sequence of commands or instructions that are executed by an interpreter program rather than compiled into a standalone executable program.

learn more… | top users | synonyms (1)

1
vote
1answer
24 views

file name as argument and sort in descending way in perl?

I have this perl script #!/usr/bin/perl use strict; open my $df, '<', 'file.txt' or die "open: $!\n"; my %h; while (<$df>) { $h{$_}++ for split /\s+/; END{ for (keys %h){ ...
1
vote
2answers
26 views

Checking URLs for HTTP code 200

I have a text file containing a list of URLs like this: http://somesite.com/some-article/ https://anothersite.fr/somepage.php?page=something What I'd like to do is check which URLs return HTTP code ...
1
vote
1answer
31 views

How to send input in a new terminal using Shell Script

I found out how to automatically send input to a C program using Shell Script. For example, if I compile this C program: //test.c int main() } int x; printf("Please enter an integer:"); ...
1
vote
0answers
8 views

OCR for getting text from an image. Error management

I want to use an OCR program to obtain some text in an image. The text is not black on white so I don't know if it will be possible. wget -q -O image ...
2
votes
3answers
23 views

Pipe files downloaded with wget into a function

I'm downloading a bunch of images with wget and I want to rm the files if they are empty with a function to which I can pass the file. My question is how do I pipe the images to a function like this: ...
0
votes
2answers
44 views

Copying two words from a string into two variables

I want to get the variables $color and $number from a string that in general is like this: "something, numColor (number)". The color might be W, U, B, R, G. If there is no color the variable color ...
4
votes
6answers
105 views

how to split file and lines

I have a text file like : 1_01 { ; quite good spirals reset=2000 type=mandel passes=1 corners=-0.6014129278/-0.5990935452/0.427747516/0.429487053 params=0/0 float=y ...
1
vote
0answers
10 views

Automatically find position, from what last command started in tmux

It is common practice in tmux to start some command, then switch to copy mode, scroll to the position, where is this command started and look over the command output. It is difficult to find the ...
8
votes
3answers
285 views

How do I do an N-way diff?

How do I diff the output of multiple commands? vimdiff can support up to four files, but diff itself seems to support exactly two files. Is it directly possible with some variant of diff, or do I ...
2
votes
1answer
61 views

Problematic bc calculation in shell script

On Ubuntu 14.04.1 64-bit LTS I am writing a shell script and if I define the start of the sequence used in the for loop with a variable instead of a constant I get really weird behavior and there are ...
1
vote
2answers
34 views

Read Command : How to verify user has typed something

I am a beginner in Bash so please bear with me. I'm trying to create an if else statement to verify that the user has entered something. If they have it should run through the commands, and if not i ...
1
vote
1answer
39 views

let script find path of itself

I want to have a bash-script discover its own path. The background is that I have a script called process_scanned_text.sh, which itself uses the script curves. I put curves in the same directory as ...
0
votes
0answers
7 views

Creating a bootable 'system profiler'

I'm trying to create a program using a small linux distribution that can be booted from a USB (kinda how DBAN operates). The program with simple output system specs upon request, no GUI, simplicity is ...
0
votes
0answers
4 views

pop up panel applets

Im using debian 7.7 with gnome classic fallback mode I like how I can put programs and scripts into the panel in custom application launchers. What i want to do is have an analog xclock is fine, in ...
0
votes
1answer
30 views

How to change date format and position in find output

Sorry if this a basic question. Say i have the following command. It's set to display a list of the last 20 files modified on my drive with the paths included. find -type f -printf '%TY-%Tm-%Td %TT ...
-2
votes
0answers
11 views

When to use a script, alias, or function [duplicate]

How do I know if a task I do regularly should be simplified with a script, alias, or function? Is there any advantage to one over the other?
-2
votes
3answers
66 views

How to list filenames within a folder based on a pattern supplied?

I'm trying to find a command that will list all files in a folder containing a keyword that is inputted. I've tried grep -l but it will not list anything
-4
votes
0answers
24 views

shell script to safely delete files by moving them to the trash can [duplicate]

The script can safely deletes a file by moving the it into the trash can, which is a directory used to hold deleted objects. The directory can be specified by the variable TRASH. If this variable is ...
3
votes
1answer
30 views

Retrieve X11 window ID of a just-launched GUI-program

I want to retrieve the X id of GUI programs I launch in background, in order to work on their windows properties. I've been so far using this workaround: myprogram & sleep 1 winID=$(wmctrl -l | ...
1
vote
2answers
39 views

script to add users to otrs

Im looking for a fast way to import customer users into otrs (ticket system) I have an export from Active Directory with: firstname lastname password email username There is a script in the otrs/bin ...
2
votes
2answers
55 views

Using Diff on a specific column in a file

Will it be possible to use diff on a specific columns in a file? file1 Something 123 item1 Something 456 item2 Something 768 item3 Something 353 item4 file2 Another 123 stuff1 Another 193 ...
0
votes
1answer
45 views

Create A Script That Responds To A Password Prompt

I'm writing a shell script that will respond to a prompt. For example, when I execute a file, the executed file will then prompt the user with this: Please enter the password: Then I want the script ...
-2
votes
1answer
43 views

Output a colon delimited file to another file [closed]

I have the following example file: root:server1:2014-12-12:x:Open:adm bin daemon lp mail other root sys users sectmp:server1:2014-12-12:x:Open:users smbnull:server1:2014-12-12:x:Locked:ids ...
0
votes
1answer
24 views

Interactive shell in background inside another shell script

I have some problems when trying to run an interactive sh session inside a shell script. The inner sh process uses all the CPU and never terminates. To reproduce the issue simply create a file named ...
1
vote
0answers
17 views

Search for the multiple string and print it to file in order [migrated]

I have a data as below, and I need to filter out the Author with "file changes and Lines Modified/Added Lines Deleted" And I need to separately print it to file with respect to Authors. If there are ...
1
vote
1answer
26 views

Shutter Script(s)

When i play some games with wine , i must not change the window , because of that , the game crash or that window are fill of black. im using xfce4 desktop , when i press "PrintScreen" key from ...
11
votes
3answers
739 views

How do you continue a sentence with a command inside

For example, I have been trying to say "There are 10 people online at the moment" in my script file. I can never seem to get the command working without the "people online at the moment" part on the ...
1
vote
2answers
39 views

ifconfig -a get needed data grepping

If I issue following command to obtain network interface data: [root@pi lib]# ifconfig -a eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.0.154 netmask ...
2
votes
2answers
46 views

Find duplicate PDF files by content

Some journals generate a different PDF for each download. APS for example stores time and the IP address in the PDF. Or there is a paper version with hyper links and one with text references. How ...
0
votes
2answers
50 views

Run two scripts at the same time

I want to run two scripts at the same time. How exactly do I do this? If I have a variable called foo in script1 and change its value to 5, and if I'm using a variable with the same name in script2 ...
1
vote
0answers
23 views

Logrotate or scripting to manipulate log file

I want to make sure that a certain log file gets empty when it reaches a specific size. I first used logrotate since the man page says: It will not modify a log multiple times in one day unless ...
0
votes
2answers
62 views

Check if a file is a text file in bash

I am trying to make a check to see if the file being attached to the email is a text file, and if it is not it returns an error. However during testing, I provide a valid text.txt and it returns the ...
0
votes
1answer
43 views

Script thinks input is a command?

I'm just getting started on a script that does basic shell commands, but the second function, which is supposed to take a valid year and month and plug them into cal, is returning with this error: ...
1
vote
5answers
100 views

How to get the unique count of a particular part of a string

I have a set of data in a file. psf7433-nlhrms unit7433-nobody unit7333-opera bpx7333-operations app7333-osm unit7330-partners psf7331-pdesmond unit7333-projm mnp7330-redirect unit7333-retailbanking ...
2
votes
3answers
65 views

How can I print only variables defined inside my shell script?

Lets supose some bash shell script like: #!/bin/bash a=3 b=7 set -o posix set In this case, the execution of the set variable or some other of the commands to print environment variables ...
1
vote
2answers
41 views

untar shell script

i have a directory in which there are multiple tar files like tweets10_1.tar tweets10_2.tar tweets10_8.tar now i want to untar these files and keep them in a directory structure like 10_1 10_2 ...
0
votes
2answers
24 views

find parent string based on regex

No sure if I can do this easily but: I have a file like VDS|name=vds01|another_parameter vol=disk01|parameter|dev=/dev/dev/my_dev1|parameter_A=some_value1 ...
2
votes
1answer
49 views

Can I control a graphical program from the command line?

How can I enter text in the text fields of the window shown by a program in an automated manner?
1
vote
2answers
64 views

How to grep for same string but multiple files at the same time?

I have a set of log files that I need to review and I would like to search specific strings on the same files at once Is this possible? Currently I am using grep -E ...
0
votes
1answer
59 views

A shell script that give the CPU information [closed]

Can someone help me to write a shell script that'll give me the following information: The state of the process; The time it passed the process in the CPU; The total memory used (in KB); The number ...
-1
votes
0answers
25 views

Ping Printer then Execute Command

I have many printers on my network using CUPS and a few pause occasionally. I can't find any consistency between them to isolate the cause so in the meantime I've made a script to view all paused ...
0
votes
1answer
27 views

Sendmail shell script not working

Can anyone help me please. I'm struggling with a issue since hours and can't seem to fix it. When I execute this script via shell it works and I also get the right email output sent to me, but when ...
2
votes
2answers
394 views

How can I automatically silence my computer at night?

I would like to set my Ubuntu computer such that I can't hear any audio between 9:59pm and 8:00am. How can I do that?
-7
votes
3answers
65 views

How do you print the current month, day and year using awk and date?

I can't seem to grab the month, day and year using awk '{print $2, $3, $6}' date Does anyone know how to?
0
votes
1answer
40 views

Shell script runs differently when schedulled with cron

I have a strange problem with my backup script. To begin with, this is the backup script: ########################################################### # CODE BEGINS HERE ...
3
votes
1answer
49 views

Export passwords from the `pass` password manager

I've been using the pass password manager for a year or so now, and it's awesome, but sometimes I like to test other password managers and then I need my passwords back. So far I've just been adding ...
1
vote
3answers
65 views

How I can determine the latest version in URL?

I'm trying to put a "function" inside of a script to install the latest version of "TeamSpeak3" Client and make all configurations. My problem is I don't know how to make a function to test the ...
0
votes
0answers
11 views

Directly start an application in a new screen/tmux session [duplicate]

Is there a way to start a new screen or tmux session, which directly executes a given command/application then detaches again? In pseudo-code something like tmux new -s ft_session --execute python ...
1
vote
5answers
103 views

find the max value of column 1 and print respective record from column 2 from file

How to find the max value from the column 1 and echo the respective path location from a file which contains n number of records. $ cat version.log 112030 /opt/oracle/app/oracle/product/11.2.0 ...
1
vote
1answer
50 views

Add 10 to a value in large xml file

I have in a large xml file some hundred svg graphs where I want to change the <svg:g transform="matrix(1 0 0 1 59.06 88.74)"> 88.74 to 98.74 i.e to add 10 to every line that starts with ...