A shell is software that lets users interact with the operating system, usually by typing at a command-line.

learn more… | top users | synonyms

0
votes
1answer
6 views

Including and excluding in one regular expression

We're using HP SiteScope system at work to monitor logs and get alerts when a special string or combination of strings is caught. There is one field where the regular expression that catches the ...
0
votes
1answer
11 views

i need to pass a string of an output file to a variable so as i can use it globally all over my script

sample output RETENTION_INTERVAL ------------------ 10080 I need to pass the numeric value "10080" from the output file to a variable .The condition should validate value and ...
0
votes
0answers
15 views

Bash script monitor file modification after its closed

It has already been asked here and I have found the solution for the first part of my question. So for the moment I have a bash script (script1) where I evaluate the sha1sum of a specific file ...
0
votes
0answers
14 views

midnight commander subshell - sharing a history file with the shell mc was started from

I am looking for a way to make midnight commander share its subshell history with the parent shell. To be more specific, when I start mc, open its subshell using Control+o and subsequently invoke a ...
-1
votes
0answers
18 views

explain the top command in andriod [on hold]

When I use the top command to get CPU information in Android, I get strange data in the following lines: User 0%, System 100%, IOW 0%, IRQ 0% User 0 + Nice 0 + Sys 6 + Idle 0 + IOW 0 + IRQ 0 + SIRQ 0 ...
0
votes
0answers
11 views

.inputrc: Delete word on option-forward delete? (OS X)

TL;DR: In my .inputrc, how do I enable the forward delete key (in conjunction with the option/meta key) to delete by word? Introduction Lately, I've been working to perfect my shell setup. I ...
0
votes
1answer
11 views

How can I configure the cancel button of dialog box bash?

dialog --backtitle "Dialog - Form sample" \ --form " Form Test - use [up] [down] to select input field " 21 70 18 \ "Network-ID:" 2 2 "" 2 15 20 0\ "Subnet Mask:" 4 2 "" 4 15 20 0\ thank you for ...
0
votes
3answers
46 views

What does this use of the echo shell command do?

I found echo -n $'\e]0;Hello World\a' in a shell script that's part of a code base I'm working on. What exactly does that do? It certainly doesn't echo anything visible. Note, I'm using Ubuntu ...
0
votes
1answer
14 views

disable users from creating new shell instances

Is there any way I can disable users from creating new shell instances through sudoers file? also disable them to set any environment variables? I would like to write a line in the sudoers file ...
0
votes
1answer
35 views

Ubuntu nested bash shell

Thanks for any help. I'm helping configure a machine to log keystrokes using /usr/bin/script function. For each session, a log file is created that includes the POSIX time. $PS1 is changed to reflect ...
0
votes
2answers
23 views

How to store results of multiple sql queries in shell variables in Bash?

I need to store in array the results retrieved from the database. So far this is basically what I'm trying with no success. Myarray=$(echo "SELECT A, B, C FROM table_a" | mysql database -u $user ...
0
votes
2answers
16 views

Output redirection at the beginning of line

I'm used to specify output redirection on the end of the line like: echo blah > output.txt Both in Windows and *nix. Recently I'm seeing more and more examples that redirect at the beginning of ...
1
vote
1answer
15 views

Yum batch install package cause 100% CPU load?

I need to install a list of package as follow; so I made a small script automate it: yum -y install libstdc++.i686 yum -y install libibcm.x86_64 yum -y install librdmacm.x86_64 yum -y install ...
1
vote
1answer
19 views

Is there an event fired right after a command finishes executing?

In Bash, after you type in a command (e.g., ls), it will execute the command, which will write its standard output (if not redirected) to the terminal (in our example, the content of the current ...
0
votes
0answers
15 views

Parsing XML log in shell

I have to parse a very large log file and I want to use the command grep (or any other tool). I am currently using PuTTy. I want to search for each log line for a specific string (let's call it AWB) ...
2
votes
5answers
209 views

UNIX how to resume process using ID?

I have a problem to resume process. I tried to get process to foreground using jobs, it works, but if i close shell and start it again. In this case i haven't my process in jobs list. I know just ...
0
votes
0answers
14 views

adb shell dumsys cpuinfo

DUMP OF SERVICE cpuinfo: Load: 9.39 / 19.22 / 14.77 CPU usage from 13119ms to 6195ms ago: **25%** 5442/com.gameloft.android.ANMP.GloftA8CN: **17% user + 8.3% kernel** / faults: 39 minor **21%** ...
0
votes
0answers
23 views

Shell script force stop without waiting for the exit code

I have written a shell script checklick.sh on my CentOS box with the following content: #!/bin/sh # # description: check link through rtmpdump # . /etc/rc.d/init.d/functions ...
3
votes
1answer
31 views

How can I check if timezone has changed in a bash script?

I have a shell script that runs via crontab, but the commands in it are timezone dependent (they refresh a table in database everyday. If the script runs during the time of a DST change, it will ...
0
votes
1answer
20 views

Damaged preference file in /bin/sh

Today in Drive Genius 3, I ran the “Verify Preferences” function in Repair. It yielded this strange result: /bin/sh: xargs: command not found The only option Drive Genius gives is to remove the ...
0
votes
0answers
7 views

Shell unbuffering for CygWin: is it possible?

I have tested on CygWin doing "ls -R" with a large directory and sending the output to a Test.txt file, so the process takes about 30 seconds to complete; the file is created, but it is empty; it will ...
1
vote
2answers
31 views

Status line in linux shell

I use Windows and Putty in order to remotely connect (ssh) to some linux servers. I have set my hardstatus in my .screenrc file so that I can monitor some useful information. But this works only when ...
1
vote
1answer
19 views

Search for string and read the next line

I need to write a shell program that installs some packages. The program will run on Linux (obviously some commands will not work, for example, on Arch-based distros). So, I've got this file called ...
0
votes
1answer
23 views

processing sequential and parallel jobs in bash script

I understand that in bash programming, comamnd1;command2;command3 will run them sequentially while command1&&command2&&command3 will run them in parallel. However what happens when I ...
0
votes
0answers
15 views

How to revoke myself rights to write files outside current directory?

I want to make sure commands that I run from my shell cannot damage my files above starting directory. For example, this command should fail: cd ~/ && rm -rf *. Supporting links, mount points ...
1
vote
1answer
21 views

Indent execution results in zshell

I'd like to customize my zshell so that the prompt is butted up against the left border like normal. I'd also like to have all execution results indent by perhaps 2 spaces. Is there a way to indent ...
2
votes
2answers
27 views

Is there a man page for PROMPT in zsh?

I know how to look up commands with the man command. When looking at other people's .zshrc files, I see what I think are builtin variables (PROMPT, RPROMPT, etc.). Where might I learn more about ...
1
vote
5answers
81 views

How can I rename/move a file by simply “editing” its path in a shell?

Consider the problem that you want to rename a file called some/path/File With A Long Name.txt into some/path/File with a very long name.txt. To me, this was always one of the few situations, where ...
2
votes
1answer
34 views

In bash 4.3.27 “su” ignores user variables when combining “-” with “-c command”?

Since forever we used to launch user scripts from a different user crontab like this: 00 12 * * 1 su - user2 -c "/home/user2/myscript.sh" By doing this, the script is launched after the interactive ...
2
votes
1answer
22 views

How to show a caret-C in canceled command line in zsh, like bash does?

When I'm in the middle of entering a line to my shell of choice, and change my mind, I can quickly throw C-c and start afresh. Under bash it looks like this: user@machine:~$ rm everything^C ...
1
vote
1answer
12 views

ZSH custom widget not working as I think it should

I'm trying to define a function so that I can launch Midnight Commander by pressing Alt-, but the function just doesn't work. I found and modified a function on another site and modified it so: ...
0
votes
0answers
31 views

Script to automate copy files with a pattern over network

I am trying to automate some tasks... I have to do some development work on one machine and other parts on another machine, with communication through a network share. I would like to copy certain ...
16
votes
3answers
870 views

Prevent currently running linux task to be killed after logout from SSH

I have a computational task running for a few days on a linux server via SSH connection. It is not on the background, so the SSH connection is under hold of the task. I want to restart the local ...
0
votes
0answers
19 views

Running terminal command on all files in folder? [duplicate]

I need to convert 500+ .xlsx files to .txt (or .csv). To do this I found this. It works well if I write the command like this: xlsx2csv fileA.xlsx fileA.txt I have however been unable to run the ...
0
votes
1answer
22 views

Tar not preserving permissions on extract

I'm backing up a users folder as root using tar tar -czf /mnt/disk/cloud.tar.gz -C /home/cloud/ . In /mnt/disk I do a test tar ztvf cloud.tar.gz and it shows -rw-r--r-- cloud/cloud 14 ...
0
votes
2answers
32 views

ascii value in bash/awk

i have a doubt, i know that with this command, it prints the value of a character based on the Ascii table: printf "%d\n" "'a" ##prints 97 But i wonder how can i make my programm show me the ascii ...
0
votes
1answer
26 views

Where do the variables of a new BASH shell come from?

I am puzzled as about how environment variables work. From what I am aware, for a new process to have some environment variables, its parent must have issued export. But what about all the variables ...
0
votes
2answers
58 views

How to check if busybox has a command?

In my case, I want to see if busybox has "md5sum" builtin. I am currently doing this: $ echo | busybox md5sum &>/dev/null && echo yes || echo no I have not been able to find any ...
2
votes
2answers
49 views

Warning for rm -r command

I want rm to prompt me when recursively deleting a directory, as in: $ rm -r <dir> Do you want to remove the dir(Y/N)? Is there an argument I can pass to rm that will do this?
0
votes
2answers
88 views

Bash script that calls a program with some asterisks in arguments

I’ve spent last hour or so trying to write a pretty simple bash script and I never felt so dumb. So I have a list of strings (which are package selector specifications for a package manager, if that ...
0
votes
1answer
29 views

Passing different set of arguments to the different commands in a linux bash script

I am writing a bash script foo.sh that runs too commands bar with first input argument, and baz with the second argument: #! /bin/bash bar "$1" baz "$2" Now I want to make foo.sh more flexible, ...
1
vote
5answers
89 views

How to copy hidden (starting with a dot) files and subdirectories in linux?

How to copy hidden files and hidden subdirectories (the ones starting with a dot) in folder A to folder B? For example if I have this structure: A/a A/b A/.a A/.b/ A/.b/somefile A/.b/.c I would ...
0
votes
0answers
14 views

OpenWrt Script (Inifinite Loop) Stops sending data over Serial Port

I have a TP Link Router TL-MR3020 flashed with the latest Attitude Adjustment. It is connected to an Arduino Uno via the usb port (usb cable into the arduino's type b connector). I have the following ...
3
votes
1answer
17 views

In bash, declare an alias that depends on current variable content

I would like to declare an alias in my .bash_profile that will use the content of a variable when the alias is used and not when it is declared. Ex: alias goSomeWhere="cd $BASE/somewhere" When ...
0
votes
1answer
33 views

modify shell command in Ubuntu 14.04

I had installed Ubuntu 14.04 on virtualbox, I need to be able to read source code of shell commands, and modify any command? any help please? where i can find the shell commands? in which directory?
0
votes
1answer
23 views

Kill browser tabs with Bash from younger to older

Hello i want to kill tabs from a browser(ex. chromium) by order from youngest to oldest. I used pkill -f -n -9 chromium but i want to use it in a while iteration with comparison to pkill's return ...
2
votes
1answer
63 views

What is the difference between “elif” and “else if” in shell scripting?

I am very new to shell scripting. When I look at some code, written for ksh (#!/bin/ksh) I see there is else if as well as elif used in one script. So, what is the difference between else if and ...
1
vote
2answers
33 views

Alter output of every command

I'd like to know if there's any way of altering output of every command I execute in terminal. The purpose is to make the output formated for my markdown howto's. E.g. ls -la .*z #>-rw-r--r-- 1 ...
1
vote
1answer
52 views

echo “something” > file not working when sh script is being executed by remote PHP server

I've got a web-server with my hardcoded webpanel for Source server management and I've got my VPS on CentOS which doesn't really want to execute sh script when asked from remote server. Web-server ...
1
vote
1answer
33 views

Good way to bookmark/navigate relative directory paths?

I work on a linux system with bash 4.x where I frequently find myself navigating different copies of very deep (and large) file directory structures. However, in reality I only need to access a ...