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)

-2
votes
0answers
46 views

Does anyone know how to make a text based game in Unix [on hold]

please help me I don't know what I'm doing send a link from a video or code I only know Unix code
1
vote
1answer
30 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 ...
-2
votes
0answers
31 views

making a delete script and a restore script

I'm looking to create two scripts; one to "delete" a script, and one to "restore" I need "del " where this will move the file located at to the dustbin directory in a way that will allow it to be ...
1
vote
0answers
23 views

Restore Trash Script not working

I made a script to send a file to a trash folder... echo "Are you sure you want to move this file to the Recycle Bin?" "(Yes/No)" read ans case "$ans" in Yes) echo "$(readlink -f "$1")" >> ...
0
votes
1answer
13 views

Cannot stat error?

Running a "restore" script which moves a file previously deleted (moved to a trashbin folder) back to where it came from. Running the secondary script I receive this error... "mv: cannot stat `test': ...
2
votes
3answers
50 views

Writing a script that outputs local users and their password expiration date

I'm new to Linux and scripting, and was doing a practice problem and am stuck on it. I'm supposed to write a script that outputs local users real name and their password expiration information. This ...
3
votes
2answers
53 views

One for loop for many tasks

The output of this code is two txt files. Can I make one for loop for both of them. i.e one for loop to give me two or more outputs? In ID1 and ID2 I have names for files. I want to print the first ...
-5
votes
1answer
41 views

Merging spreadsheets?

I have a list of LibreOffice spreadsheets (xls files) each one has one sheet. I wanted to merge all those spreadsheets in one big spreadsheet including all the tabs/sheets inside it. For example: lets ...
2
votes
1answer
25 views

Scripting: Counting users logged in onto the system

I need help with the following script. #!/bin/bash #Solution script1 who date +"Today %d %B, there are $# users logged in onto the system" In the background user1 has looged in onto tty2 and 3 and ...
4
votes
6answers
163 views

Search for an user name in file and output the user's phone number

First I made a file called telephone containing: Jan;032569874 Annemie;014588529 Hans;015253694 Stefaan;011802367 And what I now need to do is make a script where the user inputs a name ...
1
vote
1answer
34 views

How do you make case statements with ranges

I'm supposed to: Make a case statement that will display the a grade after input. With no loop or conditional. A=90-100, B=80-89, C=70-79, D=60-69, F=0-59 This is what I have so far: ...
5
votes
3answers
539 views

Shorter command for deleting files

Our web server was originally maintained by a different company. They wrote a short script to clean out cache files. Their file has several lines that read like this: /usr/bin/find ...
0
votes
0answers
55 views

I need a script master!! [closed]

i'm sorry if i will sound a total idiot to the most of you. Thanks to everyone who will have the patience to read the whole message. i bought this software called ivory for mac -which is a great piano ...
2
votes
2answers
58 views

Inputting user input automatically through bash script? [duplicate]

I am creating a bash script which creates a user and sets a password. When the command "passwd user" is run it requires the user to enter a password and stops my script. Is there any way to fulfill ...
0
votes
1answer
25 views

How do I add text to an output file?

I have a script for doing whois lookups: #!/bin/bash for domain in `cat /Users/jason/Desktop/letters.txt `; do echo $domain >> /Users/jason/Desktop/whois-results.txt whois $domain | grep ...
2
votes
1answer
49 views

What is the most portable syntax for `if` statements?

(NOTE: There is a very similar question, asked yesterday oddly enough, but it doesn't cover the main syntaxes I'm concerned with. If I were to update the other question to include them it might ...
0
votes
2answers
27 views

Grep matching cell of the csv file and index of that row

I have csv file and I want to see numbers that start with 0.99 and their row's index which is the first cell of that row. This is what I have so far: cat fil.csv | grep '0\\.99'| tee > (cut -d, ...
0
votes
4answers
79 views

Can you put an if statement within an until loop?

We have to make a script with one until loop to repeatedly ask the user for a number. - If the number is not 50, display the message, “Wrong number; try again.” - ask for another number. - If the ...
2
votes
1answer
40 views

Sorting image files based on whether the content is picture or graphics: updating an older solution?

Someone wanted to sort files in a directory according to whether the files are pictures(camera) vs. design graphics. On Stackoverflow, there is an older solution/proof-of-concept involving the ...
2
votes
2answers
33 views

Match missing values in text files

Referring to this question : Finding missing value in text file i have 2 files containing below data example Name Feature Marry Lecturer Marry Student Marry ...
2
votes
1answer
28 views

Error passing variable from bash to php

I have the following files: vars.txt C=1234567890 Ascript.php #!/usr/bin/php <?php var $C="$argv[1]"; echo "\n $C \n"; $con = mysql_connect('localhost','root','123') or die ("No connected"); ...
1
vote
1answer
89 views

Nmap script execution to detect heartbleed is failing

Wanting to setup Nmap on my Ubuntu 14.04 LTS system to detect HeartBleed vulnerability. I followed the instructions here: ...
0
votes
3answers
42 views

Reduce length of specific column in delimited text file

I need for the 5th column in a delimited text file to be reduced to just the first 5 characters. All other columns must remain unedited. Input: file1.txt column1 column2 column3 ...
3
votes
2answers
75 views

Finding missing value in text file

I have a text file with following data. Name Feature Marry Lecturer Marry Student Marry Leader Bob Lecturer Bob Student ...
1
vote
1answer
21 views

Running for loop with two variables? [duplicate]

How can I run for loop with two variables or in other words is it acceptable to do that? I will clarify my question by the following example: I have a list of letters included in a text file ...
1
vote
0answers
26 views

Hotmail not receiving emails from a script, but works from the server

I have a working mail server running Debian stable, the following elements are working. SPF DKIM rDNS My IP is not listed in any backlist, I used: mxtoolbox.com for all this. My problem: Sending ...
0
votes
1answer
20 views

How can you get ping to print human readable timestamps?

Ping can print you a timestamp on every line but its in unix date format :( ping -D localhost PING localhost.localdomain (127.0.0.1) 56(84) bytes of data. [1415629479.482938] 64 bytes from ...
0
votes
1answer
23 views

running script with -o argument pointing to mount point of sd-card

I was trying to install Angstrom Linux on Colibri T_30 board---but I am stuck at one point where it specifies that run update.sh script with optional -o argument pointing to mount point of ...
2
votes
4answers
75 views

How to display the IP address of the default Interface with Internet connection?

I need to create a script that outputs the internal IP address, that is configured as the default Interface.
3
votes
1answer
45 views

Scan ~/Downloads on new file creation

I want all new files added to ~/Downloads (and sub-folders) to be scanned with clamscan. When using Firefox on other OSes/Machines I've noticed that downloaded files sometimes get automatically ...
15
votes
2answers
292 views

Using the setuid bit properly

I have a process that needs root privileges when run by a normal user. Apparently I can use the "setuid bit" to accomplish this. What is the proper way of doing this on a POSIX system? Also, how ...
1
vote
1answer
46 views

Get two values from command output in a bash script

I have a bashscript, which executes a command and calculates a pair of values, which output can look like this. a,b (10.0000000000, 10.0000000000) -> volt (2088133.7088034691, -222653.3238934391) ...
2
votes
5answers
142 views

Re-order text on each line in a file

I'm processing a log file and I need reorder each line (not sort). The log file looks like this: 11-06-2014 - 10:49:06PM lat = 41.858657; lon = -91.345142 11-06-2014 - 10:49:49PM lat = ...
6
votes
3answers
106 views

Get 100 palindrome numbers

I'm new at scripting and I have this assignment, which is to find 100 palindrome numbers with the following algorithm: Get a two-digit random number (greater than 10) Reverse the number Sum the ...
1
vote
2answers
62 views

identify harddrive before mounting

I've recently made 2 script that take care of mounting and dismounting a harddrive in linux. The thing that I could not figure out is the following. I am currently mounting /dev/sdc1 to ...
0
votes
1answer
26 views

Security concerns

I've recently been struggling with ways to make a easy way for my father to both mount and unmount a harddrive on a linux based system. I thought of a way to execute a shell script with PHP. The ...
0
votes
2answers
29 views

Transferring data between servers

I have SSH access between two servers A (httpmydocs) and B and I am transferring data routinely from A to B using the command line: scp -rpC /var/www/httpmydocs/* ...
2
votes
0answers
51 views

Copy folders at once

I want to copy a large number of folders at once not one by one. Is it correct to use the following code ? Is it helping to run the command cp for all the folders i at once? #!/bin/bash foreach i in ...
1
vote
0answers
67 views

How to Download the latest file from SFTP server?

I need to first get the data a file was uploaded to the sftp server on, then check whether it was today's date and if so download it else echo "File not found". I would like to do all this using a ...
1
vote
1answer
45 views

Bash Script - Controls on two directories [closed]

I would like to write a bash script that implements a command which takes two parameters. The two parameters must be pathname (absolute or relative) of two directories. The two directories are not to ...
2
votes
1answer
41 views

Simulate PrintScreen key press

I want to write a script that changes the window focus, and sends keyboard commands, such as print screen, and arrow keys, to the system. As in I need print screen to capture my desktop, not the ...
2
votes
2answers
57 views

Parse several thousand lines of txt into lines and columns

The file at hand lists names, credentials, roles, and privileges for thousands of users. It was passed onto me as .xls but the lines and columns are not arranged in proper form. I have reformated ...
0
votes
1answer
50 views

Shell string escape for command arguments [duplicate]

I'm trying to create "/tmp/pwet/foo bar" with this: DIR="/tmp/pwet/foo bar" ARGS="-p ${DIR}" mkdir $ARGS For integration reasons, I have to keep the ARGS building in 2 steps: ARG = some_options + ...
6
votes
4answers
572 views

Modify a file without creating another file

Is there a way to modify a file without writing the contents to other file, without sed and awk? For example, $ cat test.txt aaa aaa bbb ccc ddd Replacing using sed with -i option, sed -i ...
0
votes
1answer
25 views

Need to compare the two files and print all the columns then missing display as NA, then join another file [duplicate]

File 1: 123, 234 345, 789 678, 900 File 2 123, abc 345, dnc output (all columns in file1 and missing value in file two as NA): 123,234,abc 345,789,dnc 678,900,NA Output file add with another ...
0
votes
1answer
53 views

script to read certain key words in a document

I have a list of 50 folders. Inside every folder I have a text file contain key words and this file has the same name in all the folders but it has different values. How can a script read a certain ...
1
vote
3answers
48 views

Renaming directory bash script - target … No such file or directory

New to bash scripting, and just need a little help. I've been testing this on a simple directory structure. I'm trying to change any directory and/or sub directory with the name "Season" to "Sn". I ...
0
votes
2answers
56 views

Permission denied when run script via ssh

I wrote script which download via scp and install some packages. SSH keys are added to host and when I run [root@HostB ~]# ./myscript everything is ok and packages are downloaded via scp without ...
2
votes
3answers
22 views

Extracting time from logs using tcl, expect

I have logs with the following pattern: 1,30.10.2014,07:51:07,0,0,1,12,28,255,3,255,255,255,0,0,0; 2001,30.10.2014,07:51:07,0,0,0,300,5,0,255; I need to extract date and time... for the first line ...
1
vote
0answers
42 views

Neutralisation of data from Windows to Unix

I just noticed that other platforms files (Windows) had to cause me many bugs, like here, in my regexes. Mostly, the line ending ^M. There seems to be many ways to do dos2unix, like here described. ...