Search Results

Search: Posts Made By: apmcd47
240
Posted By apmcd47
Please give an example of what your output should...
Please give an example of what your output should look like. Because the file as listed has 0s and 1s on all lines, and therefore grep as you propose to use it will delete all lines,


Andrew
270
Posted By apmcd47
Be more precise with your queries. Check for a...
Be more precise with your queries. Check for a word in what? If I give you a word what do you want to do with it? When you check for today's date, do you mean find the first line with that date and...
270
Posted By apmcd47
Assuming GNU tail you can either list lines from...
Assuming GNU tail you can either list lines from the end (--lines=1234) or from the beginning (--lines=+1234) of the file. Thus listing the full file could be done withtail --lines=+1 myfile
In your...
Forum: Shell Programming and Scripting 2 Weeks Ago
500
Posted By apmcd47
Short of forking bash and modifying alias, I...
Short of forking bash and modifying alias, I don't think there is a way to do what you want. However, this bash function will pollute your environment with lots of aliases. To make things easier I...
Forum: Shell Programming and Scripting 3 Weeks Ago
843
Posted By apmcd47
Please state the operating system, including...
Please state the operating system, including version, and the shell you are using.

This works in ksh93 (Version AJM 93u+ 2012-08-01) on Ubuntu 18.04.3 LTS:
$ src=source_table_@ctry_final
$...
Forum: Shell Programming and Scripting 3 Weeks Ago
840
Posted By apmcd47
I gave you a pointer in your previous thread...
I gave you a pointer in your previous thread (https://www.unix.com/shell-programming-and-scripting/282404-guidance-required-profile.html) on this subject. Forcing a shell to source the .bashrc file...
736
Posted By apmcd47
Did you find any examples on the web? This is the...
Did you find any examples on the web? This is the article I was alluding to in my previous post (https://stackoverflow.com/a/38862221). Also the output of the df command you are using needs to be...
736
Posted By apmcd47
In light of Neo's comments, I'll only give you...
In light of Neo's comments, I'll only give you some pointers.

First, install jq. It is a tool for creating, validating and editing JSON files and can be used to extract data from a JSON file,...
1,010
Posted By apmcd47
First, you need to quote your input: ./test.sh...
First, you need to quote your input:
./test.sh "[u/tmp/file.js, u/var/test.txt, u/tmp/llo.rft]"

Second, don't use the shell array construct - do this instead:
#!/bin/sh

FPATH="$1"

printf...
1,010
Posted By apmcd47
My original sed solution had a typo. This version...
My original sed solution had a typo. This version works for both the samples you gave, with and without the quotes:
#!/bin/sh

printf "Parameter 1: %s\n" "$1"
MYARRAY=`echo "$1" | sed 's/^\[//;...
1,010
Posted By apmcd47
But you are demonstrating bash constructs,...
But you are demonstrating bash constructs, particularly the string redirection, <<<.


You also need to quote each element of the python array:
$ python <<< "print ' '.join(['u/tmp/file.js',...
1,179
Posted By apmcd47
So basically you are asking, "is my login shell...
So basically you are asking, "is my login shell bash or ksh?" And if there is no bash on your system it will be ksh, because that is the default, else you will have changed it by the time your...
1,179
Posted By apmcd47
The problem with the above is, if bash exists but...
The problem with the above is, if bash exists but you are not running bash, your shell will baulk at an instruction in the .bashrc file.

Try something like this at the end of your .profile:
if [...
1,419
Posted By apmcd47
I don't think the builtin getopts allows for...
I don't think the builtin getopts allows for optional arguments, unfortunately. If you are on a GNU system and have access to the external GNU version of getopt you can have optional arguments to one...
1,529
Posted By apmcd47
So addingshopt -s histappend ...
So addingshopt -s histappend
PROMPT_COMMAND='history -a'
in your .bashrc will mimic the behaviour of ksh in that it writes all commands to its history file as (after?) it executes them.
...
1,568
Posted By apmcd47
I'm guessing which is an external command in your...
I'm guessing which is an external command in your environment. As such it doesn't take into consideration builtin commands (which is why it is much better to use type on bash, ksh and dash). The...
1,477
Posted By apmcd47
Further to Neo's and Don Cragun's comments, the...
Further to Neo's and Don Cragun's comments, the variables used in your example are shell-specific variables and therefore do not need to be exported.

Andrew
545
Posted By apmcd47
I would also be inclined to use the reverse-sort...
I would also be inclined to use the reverse-sort option to ls, and head instead of tail, thus:
cd /var/log ; ln -s $(ls -r *error_log.* | head -1) error_logAndrew
275
Posted By apmcd47
If your script is written in bash or ksh you...
If your script is written in bash or ksh you could try the following parameter substitution:
${pnewkey//\//\\\/}
It may be more readable to use a different delimiter in the sed expression:
sed...
Forum: Ubuntu 04-02-2019
554
Posted By apmcd47
Read Sampi's response...
Read Sampi's response (https://blog.christophersmart.com/2016/05/11/running-scripts-before-and-after-suspend-with-systemd/#comment-974077):

So you should be using /lib/systemd/system-sleep/ as you...
Forum: Programming 04-02-2019
282
Posted By apmcd47
Try this: (Python 2.7.12 on Ubuntu 16.04 Xenial) ...
Try this: (Python 2.7.12 on Ubuntu 16.04 Xenial)

ss = system_info['Ad_List']
searchObj = "primary"
resList = [f for f in ss if searchObj in f]

resList will be a list of one object, or...
Forum: Ubuntu 04-02-2019
554
Posted By apmcd47
According to one of the comments in the link you...
According to one of the comments in the link you posted, the correct directory for this on a Debian, and therefore Ubuntu system, is /lib/systemd/system-sleep, not /usr/lib/systemd/system-sleep.
...
Forum: Ubuntu 03-27-2019
533
Posted By apmcd47
My own tuppence worth on this: As this is...
My own tuppence worth on this:

As this is in the Ubuntu sub-forum, ps has a -b (size in bytes) option;
If you want the size of a file in bytes, surely the most accessible (and therefore most...
97
Posted By apmcd47
select appears to take note of the LINES and...
select appears to take note of the LINES and COLUMNS variables set on terminal resize. Try adding COLUMNS=0into your code prior to the select statement.

Andrew
138
Posted By apmcd47
Basically $h{$_}++returns the value of $h{$_}...
Basically $h{$_}++returns the value of $h{$_} then increments it. If there is no value at $h{$_} perl will initialise it to zero.

So, for each value that $_ may be, the first evaluation is zero...
Showing results 1 to 25 of 440

 

Featured Tech Videos

All times are GMT -4. The time now is 02:20 PM.
Unix & Linux Forums Content Copyright 1993-2019. All Rights Reserved.
Privacy Policy