Shell scripting is often considered a simple domain-specific programming language. Typical operations performed by shell scripts include file manipulation, program execution, and printing text. Further reading Better way of accepting variations of ‘Yes’ from a shell prompt Why is it better to use ...
1
vote
1answer
14 views
Trying to create a cron to Rsync then tar the folder
I'm stuck at the first hurdle!
I want to run a couple of commands from a bash script. First something like this to rsync some directories:
rsync -e ssh -az [email protected]:/home ...
1
vote
1answer
29 views
How do I execute a remote shell script over SSH and be prompted for passwords by commands that require it in that script?
I want to do something like this
ssh [email protected] ./remote_script.sh
Contents of remote_script.sh
#!/bin/bash
hg pull
This example is much simpler than what I am actually doing. I know ...
0
votes
0answers
49 views
Where can I find a storage integrity (write/read) test using basic bash scripting?
I am in need of shell scripts and/or bash commands to verify data integrity of local harddrives, usb-drives, etc.
I am looking for a solution like the famous www.heise.de/download/h2testw or ...
3
votes
2answers
49 views
Automate file transfer from Windows to Unix
I have the following situation: users update csv/txt files on daily basis on Windows. I use those flat files as input for my Oracle scripts which is on Unix. I need help on script/method of ...
1
vote
2answers
50 views
how to detect command interpreter from within a shell script [closed]
Possible Duplicate:
How to test what shell I am using in a terminal?
For example the following script
#!/bin/bash
issue_interpreter_name
would issue:
bash
1
vote
1answer
63 views
How to get exact file size and file name?
Right now I am using ls -lt /my/directory (see below) then php parses the output. But inconsistently because the delimiter is space and there might be two or more spaces in between two fields.
The ...
1
vote
2answers
59 views
How do I delete the first n lines of an ascii file using shell commands?
I have multiple files that contain ascii text information in the first 5-10 lines, followed by well-tabulated matrix information. In a shell script, I want to remove these first few lines of text so ...
1
vote
3answers
106 views
How do I run a windows executable in linux shell script?
I have an executable program (no source code, just the compiled executable) that was made in windows (.exe extension). It doesn't use any graphics... it simply reads and writes files. I want to be ...
3
votes
2answers
40 views
Insert multiline text into several files via commandline
I want to insert some code into multiple tex files foo*.tex in a directory, one line after \documentclass{.*}. Note that the files have different document classes so the .* is just a symbolic ...
1
vote
1answer
35 views
How to format a curl command for a special task?
There is a search page in a form http://site.com/search.php and it sends a search query via POST request. I want to fetch this request via curl command line tool to inspect a POST request.
The HTML ...
12
votes
7answers
670 views
What is the utility of the : command in shell scripting, given that it explicitly does nothing?
In the answer to this question about comments in shell scripting, it is indicated that the : is a null command that explicitly does nothing (but is not to be used for comments).
What would be the ...
12
votes
2answers
283 views
Multiline shell script comments - how does this work?
Recently, I stumbled upon a multiline comment type I have never seen before - here is a script example:
echo a
#
: aaa
: ddd
#
echo b
This seems to work, hell, even vim syntax-highlights it. What ...
1
vote
1answer
25 views
Load command parameters from upper level file
I've come across an interesting problem that I have not yet been able to solve satisfyingly.
Consider a note taking command that takes two arguments:
note $project $note
That simply files the ...
1
vote
2answers
30 views
Create MySQL database name using variable from date
for the variable
dbnya="echo $(date +%Y%m%d%H%M%S)"
When running below code, I will get an error (SQL syntax error)
mysql -u root -pthepass -e "CREATE DATABASE demo$dbnya CHARACTER SET utf8 ...
1
vote
1answer
51 views
Running shell commands in .sh file results to error
I have two following linux shell commands:
echo 'CPU type and model'
cat /proc/cpuinfo | head -5 | tail -1
When i run these commands directly in Terminal, i get this result truly:
CPU type and ...