如何获取在linux内核模块中执行的shell命令的返回值?

时间:2016-06-28 04:04:30

标签: shell linux-kernel

大家好!

我想获得shell命令的返回值" ls"在内核模块中。 以下是我的内核模块的源代码。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:tools="http://schemas.android.com/tools"
    tools:context=".CreateFragment">

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
        android:background="@color/red">

        <LinearLayout
            android:id="@+id/createTopView"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:background="@color/puregreen">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/createRecylerView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"/>

            <EditText
                android:id="@+id/createTitleTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Title"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:textSize="24sp" />

            <EditText
                android:id="@+id/createDescriptionTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="Description"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:textSize="18sp" />

            <EditText
                android:id="@+id/createTagsTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="+ Tags"
                android:textAppearance="?android:attr/textAppearanceLarge"
                android:textSize="18sp" />

            <RelativeLayout
                android:id="@+id/createBottomToolbar"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

                <Button
                    android:id="@+id/createCoinButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:background="@drawable/button_rounded"
                    android:text="FREE"
                    android:textSize="14sp" />

                <Button
                    android:id="@+id/createPostButton"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_alignParentEnd="true"
                    android:layout_alignParentBottom="true"
                    android:background="@color/my_blue"
                    android:text="POST"
                    android:textColor="#ffffff"
                    android:textSize="14sp" />

            </RelativeLayout>
        </LinearLayout>
    </ScrollView>
</RelativeLayout>

有没有人知道如何获得&#34; ls / home&#34的输出?

谢谢!

0 个答案:

没有答案